Registry.require(["promise","helper","asker"],function(){var f=Registry.get("promise"),g=Registry.get("helper"),h=Registry.get("asker"),c=!1,b=null,d=function(){var a=f(),b=function(){c?window.setTimeout(b,50):a.resolve()};b();return a.promise()},e={permContentSettings:"contentSettings",permDownloads:"downloads",clear:function(){c&&console.log("perm: clear, but locked");b=null},get:function(){var a=f();c=!0;b={};rea.permissions.getAll(function(k){g.each(k.permissions,function(a,c){b[a]=!0});c=!1;
a.resolve()});return a.promise()},has:function(a){return d().then(function(){return b?!!b[a]:e.get().then(function(){return e.has(a)})})},ask:function(a,c,e){var d=f();h.askForPermission(a,c,e).done(function(c){c.granted&&(b||(b={}),b[a]=!0);d.resolve(c.granted)});return d.promise()},remove:function(a){return d().then(function(){var d=f();c=!0;rea.permissions.remove({permissions:[a]},function(e){c=!1;b&&(b[a]=!1);d.resolve(e)});return d.promise()})}};Registry.register("permission","0",
e)});
