32 const Cc = Components.classes;
33 const Ci = Components.interfaces;
36 .getService(
Ci.nsIStringBundleService);
37 var
brandBundle = bundleSvc.createBundle(
"chrome://branding/locale/brand.properties");
38 var
browserBundle = bundleSvc.createBundle(
"chrome://browser/locale/browser.properties");
40 var
prefSvc =
Cc[
"@mozilla.org/preferences-service;1"]
41 .getService(
Ci.nsIPrefBranch);
46 case "xpinstall-install-blocked":
48 var installInfo = aSubject.QueryInterface(
Ci.nsIXPIInstallInfo);
49 var
win = installInfo.originatingWindow;
50 var shell = win.QueryInterface(
Ci.nsIInterfaceRequestor)
51 .getInterface(
Ci.nsIWebNavigation)
52 .QueryInterface(
Ci.nsIDocShell);
53 var host = installInfo.originatingURI.host;
54 var brandShortName = brandBundle.GetStringFromName(
"brandShortName");
55 var notificationName, messageString, buttons;
56 if (!prefSvc.getBoolPref(
"xpinstall.enabled")) {
57 notificationName =
"xpinstall-disabled"
58 if (prefSvc.prefIsLocked(
"xpinstall.enabled")) {
59 messageString = browserBundle.GetStringFromName(
"xpinstallDisabledMessageLocked");
63 messageString = browserBundle.formatStringFromName(
"xpinstallDisabledMessage",
64 [brandShortName, host], 2);
67 label: browserBundle.GetStringFromName(
"xpinstallDisabledButton"),
68 accessKey: browserBundle.GetStringFromName(
"xpinstallDisabledButton.accesskey"),
71 prefSvc.setBoolPref(
"xpinstall.enabled",
true);
78 notificationName =
"xpinstall"
79 messageString = browserBundle.formatStringFromName(
"xpinstallPromptWarning",
80 [brandShortName, host], 2);
83 label: browserBundle.GetStringFromName(
"xpinstallPromptAllowButton"),
84 accessKey: browserBundle.GetStringFromName(
"xpinstallPromptAllowButton.accesskey"),
87 var mgr = Components.classes[
"@mozilla.org/xpinstall/install-manager;1"]
88 .createInstance(Components.interfaces.nsIXPInstallManager);
89 mgr.initManagerWithInstallInfo(installInfo);
95 const iconURL =
"chrome://songbird/skin/base-elements/icon-generic-addon.png";
97 var notificationBox = gBrowser.getNotificationBox(gBrowser.getBrowserAtIndex(0));
98 const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
99 gBrowser.showNotification(shell, notificationName, messageString,
100 iconURL, priority, buttons);
104 handleEvent:
function() {
105 os.removeObserver(xpinstallObserver,
"xpinstall-install-blocked");
111 var
os =
Cc[
"@mozilla.org/observer-service;1"].getService(
Ci.nsIObserverService);
112 os.addObserver(xpinstallObserver,
"xpinstall-install-blocked",
false);
handlersMenuPopup addEventListener("command", this, false)
this _contentSandbox label
this removeEventListener("load", this.__SS_restore, true)
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe