From 72bab89cf6c77c9ee95a977c306e6ce317b84835 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 25 May 2018 20:45:48 +0000 Subject: Revert "Remove the Social API" --- browser/components/about/AboutRedirector.cpp | 10 ++++++ browser/components/build/nsModule.cpp | 2 ++ .../customizableui/CustomizableWidgets.jsm | 41 ++++++++++++++++++++++ .../customizableui/content/panelUI.inc.xul | 2 ++ 4 files changed, 55 insertions(+) (limited to 'browser/components') diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index b77949ea7..5e8df6ab2 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -56,6 +56,16 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::HIDE_FROM_ABOUTABOUT }, + { + "socialerror", "chrome://browser/content/aboutSocialError.xhtml", + nsIAboutModule::ALLOW_SCRIPT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "providerdirectory", "chrome://browser/content/aboutProviderDirectory.xhtml", + nsIAboutModule::ALLOW_SCRIPT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, { "tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp index 1baccd710..967da3ebc 100644 --- a/browser/components/build/nsModule.cpp +++ b/browser/components/build/nsModule.cpp @@ -90,6 +90,8 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = { { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, #endif { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "providerdirectory", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "tabcrashed", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "feeds", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index 3e00d385f..3e83b081c 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -556,6 +556,47 @@ const CustomizableWidgets = [ clearSubview(sidebarItems); fillSubviewFromMenuItems([...menu.children], sidebarItems); } + }, { + id: "social-share-button", + // custom build our button so we can attach to the share command + type: "custom", + onBuild: function(aDocument) { + let node = aDocument.createElementNS(kNSXUL, "toolbarbutton"); + node.setAttribute("id", this.id); + node.classList.add("toolbarbutton-1"); + node.classList.add("chromeclass-toolbar-additional"); + node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label")); + node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext")); + node.setAttribute("removable", "true"); + node.setAttribute("observes", "Social:PageShareable"); + node.setAttribute("command", "Social:SharePage"); + + let listener = { + onWidgetAdded: (aWidgetId) => { + if (aWidgetId != this.id) + return; + + Services.obs.notifyObservers(null, "social:" + this.id + "-added", null); + }, + + onWidgetRemoved: aWidgetId => { + if (aWidgetId != this.id) + return; + + Services.obs.notifyObservers(null, "social:" + this.id + "-removed", null); + }, + + onWidgetInstanceRemoved: (aWidgetId, aDoc) => { + if (aWidgetId != this.id || aDoc != aDocument) + return; + + CustomizableUI.removeListener(listener); + } + }; + CustomizableUI.addListener(listener); + + return node; + } }, { id: "add-ons-button", shortcutId: "key_openAddons", diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul index 077d9c014..1b8fc0236 100644 --- a/browser/components/customizableui/content/panelUI.inc.xul +++ b/browser/components/customizableui/content/panelUI.inc.xul @@ -240,6 +240,8 @@ onclick="PanelUI.hide();"/> + + -- cgit v1.2.3