Bug 841058 - Remove unused PageActions code and strings from /browser/metro [r=jimm]

This commit is contained in:
Matt Brubeck 2013-02-13 10:47:05 -08:00
parent 8f0f5d7559
commit 7a517d7a63
8 changed files with 1 additions and 155 deletions

View File

@ -14,10 +14,6 @@ var PageActions = {
this.register("pageaction-reset", this.updatePagePermissions, this);
this.register("pageaction-password", this.updateForgetPassword, this);
#ifdef NS_PRINTING
this.register("pageaction-saveas", this.updatePageSaveAs, this);
#endif
this.register("pageaction-share", this.updateShare, this);
CharsetMenu.init();
},
@ -134,30 +130,6 @@ var PageActions = {
aEvent.stopPropagation(); // Don't hide the site menu.
},
pinSite : function pinCurrentSite() {
if (Browser.selectedBrowser.currentURI.spec.length == 0) {
return;
}
Browser.pinSite();
},
unpinSite : function unpinCurrentSite() {
if (Browser.selectedBrowser.currentURI.spec.length == 0) {
return;
}
Browser.unpinSite();
},
updatePageSaveAs: function updatePageSaveAs(aNode) {
// Check for local XUL content
let contentWindow = Browser.selectedBrowser.contentWindow;
return !(contentWindow && contentWindow.document instanceof XULDocument);
},
updateShare: function updateShare(aNode) {
return Util.isShareableScheme(Browser.selectedBrowser.currentURI.scheme);
},
hideItem: function hideItem(aNode) {
aNode.hidden = true;
this._updateAttributes();

View File

@ -101,7 +101,6 @@ Cu.import("resource://gre/modules/Geometry.jsm");
["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"],
["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"],
["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"],
["SharingUI", "chrome://browser/content/helperui/SharingUI.js"],
["FullScreenVideo", "chrome://browser/content/video.js"],
["AnimatedZoom", "chrome://browser/content/AnimatedZoom.js"],
["CommandUpdater", "chrome://browser/content/commandUtil.js"],

View File

@ -358,17 +358,10 @@
</box>
<hbox id="pageactions-container" hidden="true">
<pageaction id="pageaction-findinpage" title="&pageactions.findInPage;"
onclick="FindHelperUI.show();"/>
<pageaction id="pageaction-share" title="&pageactions.share.page;"
onclick="SharingUI.show(getBrowser().currentURI.spec, getBrowser().contentTitle);"/>
<pageaction id="pageaction-pinsite" title="&pageactions.pin.site;"
onclick="PageActions.pinSite();"/>
<pageaction id="pageaction-password" title="&pageactions.password.forget;"
onclick="PageActions.forgetPassword(event);"/>
<pageaction id="pageaction-reset" title="&pageactions.reset;"
onclick="PageActions.clearPagePermissions(event);"/>
<pageaction id="pageaction-search" title="&pageactions.search.addNew;"/>
<pageaction id="pageaction-charset" title="&pageactions.charEncoding;" onclick="CharsetMenu.show();"/>
</hbox>
</arrowbox>

View File

@ -1,83 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var SharingUI = {
_dialog: null,
show: function show(aURL, aTitle) {
try {
this.showSharingUI(aURL, aTitle);
} catch (ex) {
this.showFallback(aURL, aTitle);
}
},
showSharingUI: function showSharingUI(aURL, aTitle) {
let sharingSvc = Cc["@mozilla.org/uriloader/external-sharing-app-service;1"].getService(Ci.nsIExternalSharingAppService);
sharingSvc.shareWithDefault(aURL, "text/plain", aTitle);
},
showFallback: function showFallback(aURL, aTitle) {
this._dialog = DialogUI.importModal(window, "chrome://browser/content/prompt/share.xul", null);
document.getElementById("share-title").value = aTitle || aURL;
DialogUI.pushPopup(this, this._dialog);
let bbox = document.getElementById("share-buttons-box");
this._handlers.forEach(function(handler) {
let button = document.createElement("button");
button.className = "action-button";
button.setAttribute("label", handler.name);
button.addEventListener("command", function() {
SharingUI.hide();
handler.callback(aURL || "", aTitle || "");
}, false);
bbox.appendChild(button);
});
this._dialog.waitForClose();
DialogUI.popPopup(this);
},
hide: function hide() {
this._dialog.close();
this._dialog = null;
},
_handlers: [
{
name: "Email",
callback: function callback(aURL, aTitle) {
let url = "mailto:?subject=" + encodeURIComponent(aTitle) +
"&body=" + encodeURIComponent(aURL);
let uri = Services.io.newURI(url, null, null);
let extProtocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
.getService(Ci.nsIExternalProtocolService);
extProtocolSvc.loadUrl(uri);
}
},
{
name: "Twitter",
callback: function callback(aURL, aTitle) {
let url = "http://twitter.com/home?status=" + encodeURIComponent((aTitle ? aTitle+": " : "")+aURL);
BrowserUI.newTab(url, Browser.selectedTab);
}
},
{
name: "Google Reader",
callback: function callback(aURL, aTitle) {
let url = "http://www.google.com/reader/link?url=" + encodeURIComponent(aURL) +
"&title=" + encodeURIComponent(aTitle);
BrowserUI.newTab(url, Browser.selectedTab);
}
},
{
name: "Facebook",
callback: function callback(aURL, aTitle) {
let url = "http://www.facebook.com/share.php?u=" + encodeURIComponent(aURL);
BrowserUI.newTab(url, Browser.selectedTab);
}
}
]
};

View File

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE prompt SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog id="share-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_cancel" oncommand="SharingUI.hide();"/>
</commandset>
<vbox class="prompt-inner">
<hbox class="prompt-header">
<label id="share-title" crop="center" flex="1"/>
</hbox>
<hbox id="share-buttons-box" class="prompt-buttons"/>
</vbox>
</dialog>

View File

@ -37,7 +37,6 @@ chrome.jar:
content/prompt/promptPassword.xul (content/prompt/promptPassword.xul)
content/prompt/select.xul (content/prompt/select.xul)
content/prompt/prompt.js (content/prompt/prompt.js)
content/prompt/share.xul (content/prompt/share.xul)
content/prompt/masterPassword.xul (content/prompt/masterPassword.xul)
content/prompt/removeMasterPassword.xul (content/prompt/removeMasterPassword.xul)
@ -52,7 +51,6 @@ chrome.jar:
content/helperui/OfflineApps.js (content/helperui/OfflineApps.js)
content/helperui/SelectHelperUI.js (content/helperui/SelectHelperUI.js)
content/helperui/SelectionHelperUI.js (content/helperui/SelectionHelperUI.js)
content/helperui/SharingUI.js (content/helperui/SharingUI.js)
content/helperui/FormHelperUI.js (content/helperui/FormHelperUI.js)
content/helperui/FindHelperUI.js (content/helperui/FindHelperUI.js)

View File

@ -97,11 +97,6 @@
<!ENTITY contextRemoveBookmark.label "Remove">
<!ENTITY contextShortcutBookmark.label "Add to Home Screen">
<!ENTITY pageactions.pin.site "Pin Site">
<!ENTITY pageactions.share.page "Share Page">
<!ENTITY pageactions.password.forget "Forget Password">
<!ENTITY pageactions.quit "Quit">
<!ENTITY pageactions.reset "Clear Site Preferences">
<!ENTITY pageactions.findInPage "Find In Page">
<!ENTITY pageactions.search.addNew "Add Search Engine">
<!ENTITY pageactions.charEncoding "Character Encoding">

View File

@ -102,8 +102,7 @@ tabs.emptyTabTitle=New Tab
# or webpage title on the menulist
homepage.custom2=Custom Page
# Page Actions
pageactions.pin.site=Pin Site
# "Clear Permissions" items
pageactions.geolocation=Location
pageactions.popup=Popups
pageactions.offline-app=Offline Storage