
Components.utils.import("resource://avg/Preferences.js");Components.utils.import("resource://avg/avgJsm.js");Components.utils.import("resource://avg/IOJsm.js");Components.utils.import("resource://gre/modules/AddonManager.jsm");var EXPORTED_SYMBOLS=["PasswordBox_avg"];var PasswordBox_avg={addonId:"firefox@passwordbox.com",addonIdAVG:"avg@toolbar",passwordBoxDomObj:null,init:function(domObj){AddonManager.getAddonByID(this.addonId,function(addon){if((addon.scope==1||addon.scope==2)&&addon.syncGUID!==null){return;}
PasswordBox_avg.passwordBoxDomObj=PasswordBox_avg.passwordBoxDomObj===null?domObj:PasswordBox_avg.passwordBoxDomObj;var hiddenState=PasswordBox_avg.passwordBoxDomObj.getAttribute("hidden");PasswordBox_avg.setAddonState(hiddenState);AddonManager.addAddonListener(PasswordBox_avg);Preferences.observe(Domains_avg.PartnerID+".userPreferences.toolbarItems",PasswordBox_avg.prefObserver);});},setAddonState:function(hiddenState){var pwdBoxUserDisabled=Preferences.get(Domains_avg.PartnerID+".userPreferences.pwdBoxUserDisabled",false);if(hiddenState=="false"){if(!pwdBoxUserDisabled){this.enable();}else{this.disable();}}else{PasswordBox_avg._pwdBoxDisableByAVG=true;this.disable();}},prefObserver:function(prefValue){if(typeof prefValue==="undefined"||prefValue===""){return;}
prefValue=JSON.parse(prefValue);var fid=PasswordBox_avg.passwordBoxDomObj.getAttribute("fid");var visible=prefValue[fid]["visible"];var hiddenState="false";if(!visible){hiddenState="true";}
PasswordBox_avg.setAddonState(hiddenState);PasswordBox_avg.passwordBoxDomObj.setAttribute("hidden",hiddenState);},enable:function(){AddonManager.getAddonByID(this.addonId,function(addon){if(!addon.isActive){addon.userDisabled=false;}});},disable:function(){AddonManager.getAddonByID(this.addonId,function(addon){if(addon.isActive){addon.userDisabled=true;}});},_pwdBoxDisableByAVG:false,onDisabling:function(addon){if(addon.id==PasswordBox_avg.addonId){if(!PasswordBox_avg._pwdBoxDisableByAVG){Preferences.set(Domains_avg.PartnerID+".userPreferences.pwdBoxUserDisabled",true);}
LogAddonMsgs_avg.CreateDumpLogString("Add-on disabled: "+PasswordBox_avg.addonId);}else if(addon.id==PasswordBox_avg.addonIdAVG){PasswordBox_avg._pwdBoxDisableByAVG=true;PasswordBox_avg.disable();}},onEnabling:function(addon){if(addon.id==PasswordBox_avg.addonId){Preferences.set(Domains_avg.PartnerID+".userPreferences.pwdBoxUserDisabled",false);}}};