b=437959, r=gavin. View, install and remove add-ons

This commit is contained in:
Mark Finkle 2008-08-19 22:18:36 -04:00
Родитель 5ab9e26115
Коммит ff244820e1
6 изменённых файлов: 145 добавлений и 41 удалений

Просмотреть файл

@ -104,22 +104,41 @@ pref("layout.spellcheckDefault", 1);
/* extension manager and xpinstall */
pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes");
pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=extensions");
pref("xpinstall.dialog.progress.type.skin", "Extension:Manager-themes");
pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager-extensions");
pref("xpinstall.dialog.progress.skin", "chrome://browser/content/browser.xul");
pref("xpinstall.dialog.progress.chrome", "chrome://browser/content/browser.xul");
pref("xpinstall.dialog.progress.type.skin", "navigator:browser");
pref("xpinstall.dialog.progress.type.chrome", "navigator:browser");
pref("extensions.update.enabled", true);
pref("extensions.update.interval", 86400);
pref("extensions.dss.enabled", false);
pref("extensions.dss.switchPending", false);
pref("extensions.ignoreMTimeChanges", false);
pref("extensions.logging.enabled", false);
pref("extensions.hideInstallButton", true);
/* these point at AMO */
pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");
/* preferences for the Get Add-ons pane */
pref("extensions.getAddons.showPane", true);
pref("extensions.getAddons.browseAddons", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%");
pref("extensions.getAddons.maxResults", 5);
pref("extensions.getAddons.recommended.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/recommended");
pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/featured/all/10/%OS%/%VERSION%");
pref("extensions.getAddons.search.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/search?q=%TERMS%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/10/%OS%/%VERSION%");
/* blocklist preferences */
pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/2/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/");
pref("extensions.blocklist.detailsURL", "http://%LOCALE%.www.mozilla.com/%LOCALE%/blocklist/");
/* dictionary download preference */
pref("browser.dictionaries.download.url", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/dictionaries/");
/* make clicking on links stand out a bit */
pref("browser.display.use_focus_colors", true);
pref("browser.display.focus_background_color", "#ffffa0");
@ -146,7 +165,7 @@ pref("browser.search.defaultenginename", "chrome://browser/locale/region.pr
// disable logging for the search service by default
pref("browser.search.log", false);
// Ordering of Search Engines in the Engine list.
// Ordering of Search Engines in the Engine list.
pref("browser.search.order.1", "chrome://browser/locale/region.properties");
pref("browser.search.order.2", "chrome://browser/locale/region.properties");

Просмотреть файл

@ -44,9 +44,10 @@ const PANELMODE_URLVIEW = 1;
const PANELMODE_URLEDIT = 2;
const PANELMODE_BOOKMARK = 3;
const PANELMODE_BOOKMARKLIST = 4;
const PANELMODE_SIDEBAR = 5;
const PANELMODE_TABLIST = 6;
const PANELMODE_FULL = 7;
const PANELMODE_ADDONS = 5;
const PANELMODE_SIDEBAR = 6;
const PANELMODE_TABLIST = 7;
const PANELMODE_FULL = 8;
var BrowserUI = {
_panel : null,
@ -399,12 +400,9 @@ var BrowserUI = {
var urllist = document.getElementById("urllist-container");
var sidebar = document.getElementById("browser-controls");
var tablist = document.getElementById("tab-list-container");
var addons = document.getElementById("addons-container");
var container = document.getElementById("browser-container");
// Make sure the UI elements are sized correctly since the window size can change
//sidebar.left = toolbar.width = container.boxObject.width;
//sidebar.height = tablist.height = container.boxObject.height;
if (aMode == PANELMODE_URLVIEW || aMode == PANELMODE_SIDEBAR ||
aMode == PANELMODE_TABLIST || aMode == PANELMODE_FULL)
{
@ -415,6 +413,7 @@ var BrowserUI = {
this._caption.hidden = false;
bookmark.hidden = true;
urllist.hidden = true;
addons.hidden = true;
let sidebarTo = toolbar.boxObject.width;
let tablistTo = -tablist.boxObject.width;
@ -434,6 +433,7 @@ var BrowserUI = {
bookmark.hidden = true;
urllist.hidden = true;
addons.hidden = true;
sidebar.left = toolbar.boxObject.width;
tablist.left = -tablist.boxObject.width;
}
@ -449,6 +449,7 @@ var BrowserUI = {
tablist.left = -tablist.boxObject.width;
bookmark.hidden = false;
addons.hidden = true;
bookmark.width = container.boxObject.width;
}
else if (aMode == PANELMODE_BOOKMARKLIST) {
@ -459,6 +460,7 @@ var BrowserUI = {
this._caption.hidden = false;
bookmark.hidden = true;
addons.hidden = true;
sidebar.left = toolbar.boxObject.width;
tablist.left = -tablist.boxObject.width;
@ -466,6 +468,25 @@ var BrowserUI = {
urllist.width = container.boxObject.width;
urllist.height = container.boxObject.height;
}
else if (aMode == PANELMODE_ADDONS) {
this._showToolbar();
toolbar.setAttribute("mode", "view");
this._edit.hidden = true;
this._edit.reallyClosePopup();
this._caption.hidden = false;
bookmark.hidden = true;
sidebar.left = toolbar.boxObject.width;
tablist.left = -tablist.boxObject.width;
var iframe = document.getElementById("addons-items-container");
if (iframe.getAttribute("src") == "")
iframe.setAttribute("src", "chrome://mozapps/content/extensions/extensions.xul");
addons.hidden = false;
addons.width = container.boxObject.width;
addons.height = container.boxObject.height - toolbar.boxObject.height;
}
else if (aMode == PANELMODE_NONE) {
this._hideToolbar();
sidebar.left = toolbar.boxObject.width;
@ -474,6 +495,7 @@ var BrowserUI = {
this._edit.reallyClosePopup();
urllist.hidden = true;
bookmark.hidden = true;
addons.hidden = true;
}
},
@ -609,6 +631,8 @@ var BrowserUI = {
case "cmd_menu":
case "cmd_newTab":
case "cmd_closeTab":
case "cmd_addons":
case "cmd_actions":
isSupported = true;
break;
default:
@ -673,7 +697,8 @@ var BrowserUI = {
this.showBookmarks();
break;
case "cmd_menu":
if (this.mode == PANELMODE_FULL)
// XXX Remove PANELMODE_ADDON when design changes
if (this.mode == PANELMODE_FULL || this.mode == PANELMODE_ADDONS)
this.show(PANELMODE_NONE);
else
this.show(PANELMODE_FULL);
@ -683,6 +708,11 @@ var BrowserUI = {
break;
case "cmd_closeTab":
Browser.content.removeTab(Browser.content.browser);
break;
case "cmd_addons":
case "cmd_actions":
this.show(PANELMODE_ADDONS);
break;
}
}
};

Просмотреть файл

@ -102,6 +102,10 @@ var Browser = {
return new ProgressController(content, browser);
};
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
os.addObserver(gXPInstallObserver, "xpinstall-download-started", false);
this._content.tabList = document.getElementById("tab-list");
this._content.newTab(true);
this._content.addEventListener("DOMTitleChanged", this, true);
@ -220,7 +224,6 @@ var Browser = {
var isSupported = false;
switch (cmd) {
case "cmd_fullscreen":
case "cmd_addons":
case "cmd_downloads":
isSupported = true;
break;
@ -242,31 +245,6 @@ var Browser = {
case "cmd_fullscreen":
window.fullScreen = !window.fullScreen;
break;
case "cmd_addons":
{
const EMTYPE = "Extension:Manager";
var aOpenMode = "extensions";
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var needToOpen = true;
var windowType = EMTYPE + "-" + aOpenMode;
var windows = wm.getEnumerator(windowType);
while (windows.hasMoreElements()) {
var theEM = windows.getNext().QueryInterface(Ci.nsIDOMWindowInternal);
if (theEM.document.documentElement.getAttribute("windowtype") == windowType) {
theEM.focus();
needToOpen = false;
break;
}
}
if (needToOpen) {
const EMURL = "chrome://mozapps/content/extensions/extensions.xul?type=" + aOpenMode;
const EMFEATURES = "chrome,dialog=no,resizable=yes";
window.openDialog(EMURL, "", EMFEATURES);
}
break;
}
case "cmd_downloads":
Cc["@mozilla.org/download-manager-ui;1"].getService(Ci.nsIDownloadManagerUI).show(window);
break;
@ -302,7 +280,7 @@ var Browser = {
else
findbar.onFindAgainCommand(Browser.findState == FINDSTATE_FIND_PREVIOUS);
},
translatePhoneNumbers: function() {
let doc = getBrowser().contentDocument;
let textnodes = doc.evaluate("//text()",
@ -854,6 +832,68 @@ const gPopupBlockerObserver = {
}
};
const gXPInstallObserver = {
observe: function (aSubject, aTopic, aData)
{
var brandBundle = document.getElementById("bundle_brand");
var browserBundle = document.getElementById("bundle_browser");
switch (aTopic) {
case "xpinstall-install-blocked":
var installInfo = aSubject.QueryInterface(Components.interfaces.nsIXPIInstallInfo);
var host = installInfo.originatingURI.host;
var brandShortName = brandBundle.getString("brandShortName");
var notificationName, messageString, buttons;
if (!gPrefService.getBoolPref("xpinstall.enabled")) {
notificationName = "xpinstall-disabled"
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
messageString = browserBundle.getString("xpinstallDisabledMessageLocked");
buttons = [];
}
else {
messageString = browserBundle.getFormattedString("xpinstallDisabledMessage",
[brandShortName, host]);
buttons = [{
label: browserBundle.getString("xpinstallDisabledButton"),
accessKey: browserBundle.getString("xpinstallDisabledButton.accesskey"),
popup: null,
callback: function editPrefs() {
gPrefService.setBoolPref("xpinstall.enabled", true);
return false;
}
}];
}
}
else {
notificationName = "xpinstall"
messageString = browserBundle.getFormattedString("xpinstallPromptWarning",
[brandShortName, host]);
buttons = [{
label: browserBundle.getString("xpinstallPromptAllowButton"),
accessKey: browserBundle.getString("xpinstallPromptAllowButton.accesskey"),
popup: null,
callback: function() {
// Force the addon manager panel to appear
CommandUpdater.doCommand("cmd_addons");
var mgr = Cc["@mozilla.org/xpinstall/install-manager;1"].createInstance(Ci.nsIXPInstallManager);
mgr.initManagerWithInstallInfo(installInfo);
return false;
}
}];
}
var nBox = Browser.getNotificationBox();
if (!nBox.getNotificationWithValue(notificationName)) {
const priority = nBox.PRIORITY_WARNING_MEDIUM;
const iconURL = "chrome://mozapps/skin/update/update.png";
nBox.appendNotification(messageString, notificationName, iconURL, priority, buttons);
}
break;
}
}
};
function getNotificationBox(aWindow) {
return Browser.getNotificationBox();
};
}

Просмотреть файл

@ -89,6 +89,7 @@
<command id="cmd_fullscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_addons" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_downloads" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_actions" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- scrolling -->
<command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
@ -266,6 +267,10 @@
</hbox>
</vbox>
</vbox>
<vbox id="addons-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
<iframe id="addons-items-container" flex="1" src=""/>
</vbox>
</stack>
<vbox id="findpanel-placeholder" sizetopopup="always">

Просмотреть файл

@ -15,10 +15,12 @@ browser.jar:
% locale branding @AB_CD@ %branding/
branding/brand.dtd (locale/@AB_CD@/brand/brand.dtd)
branding/brand.properties (locale/@AB_CD@/brand/brand.properties)
% style chrome://mozapps/content/extensions/extensions.xul chrome://browser/skin/extensions.css
classic.jar:
% skin browser classic/1.0 %
browser.css (skin/browser.css)
extensions.css (skin/extensions.css)
images/close.png (skin/images/close.png)
images/close-small.png (skin/images/close-small.png)
images/default-favicon.png (skin/images/default-favicon.png)

Просмотреть файл

@ -6,6 +6,14 @@ popupButtonAlwaysAllow.accesskey=A
popupButtonNeverWarn=Never tell me
popupButtonNeverWarn.accesskey=N
# XPInstall
xpinstallPromptWarning=%S prevented this site (%S) from asking you to install software on your computer.
xpinstallPromptAllowButton=Allow
xpinstallPromptAllowButton.accesskey=A
xpinstallDisabledMessageLocked=Software installation has been disabled by your system administrator.
xpinstallDisabledMessage=Software installation is currently disabled. Click Enable and try again.
xpinstallDisabledButton=Enable
xpinstallDisabledButton.accesskey=n
# Site Identity
identity.identified.verifier=Verified by: %S