Bug 554007: New add-ons manager UI (browser parts). r=sdwilsh

This commit is contained in:
Blair McBride 2010-04-29 10:17:06 -07:00
parent 40470d9549
commit e47441825e
2 changed files with 24 additions and 30 deletions

View File

@ -5727,21 +5727,8 @@ var MailIntegration = {
};
function BrowserOpenAddonsMgr(aPane) {
const EMTYPE = "Extension:Manager";
var theEM = Services.wm.getMostRecentWindow(EMTYPE);
if (theEM) {
theEM.focus();
if (aPane)
theEM.showView(aPane);
return;
}
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
if (aPane)
window.openDialog(EMURL, "", EMFEATURES, aPane);
else
window.openDialog(EMURL, "", EMFEATURES);
// TODO need to implement switching to the relevant view - see bug 560449
switchToTabHavingURI("about:addons", true);
}
function AddKeywordForSearchField() {
@ -7522,8 +7509,10 @@ var LightWeightThemeWebInstaller = {
},
_isAllowed: function (node) {
var pm = Services.perms;
var uri = node.ownerDocument.documentURIObject;
return Services.perms.testPermission(uri, "install") == pm.ALLOW_ACTION;
return pm.testPermission(uri, "install") == pm.ALLOW_ACTION;
},
_getThemeFromNode: function (node) {
@ -7532,7 +7521,18 @@ var LightWeightThemeWebInstaller = {
}
}
function switchToTabHavingURI(aURI) {
/**
* Switch to a tab that has a given URI, and focusses its browser window.
* If a matching tab is in this window, it will be switched to. Otherwise, other
* windows will be searched.
*
* @param aURI
* URI to search for
* @param aOpenNew
* True to open a new tab and switch to it, if no existing tab is found
* @return True if a tab was switched to (or opened), false otherwise
*/
function switchToTabHavingURI(aURI, aOpenNew) {
function switchIfURIInWindow(aWindow) {
if (!("gBrowser" in aWindow))
return false;
@ -7567,7 +7567,13 @@ function switchToTabHavingURI(aURI) {
if (switchIfURIInWindow(browserWin))
return true;
}
// No opened tab has that url.
if (aOpenNew) {
gBrowser.selectedTab = gBrowser.addTab(aURI.spec);
return true;
}
return false;
}

View File

@ -461,18 +461,6 @@ var gMainPane = {
*/
showAddonsMgr: function ()
{
const EMTYPE = "Extension:Manager";
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var theEM = wm.getMostRecentWindow(EMTYPE);
if (theEM) {
theEM.focus();
theEM.showView("extensions");
return;
}
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
window.openDialog(EMURL, "", EMFEATURES, "extensions");
openUILinkIn("about:addons", "window");
}
};