diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index 8ab404ca444..92c1bd23939 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -266,6 +266,10 @@ label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey2;" oncommand="gContextMenu.savePageAs();"/> + diff --git a/browser/base/content/browser-doctype.inc b/browser/base/content/browser-doctype.inc index ad08f4b0346..cc1fb950f45 100644 --- a/browser/base/content/browser-doctype.inc +++ b/browser/base/content/browser-doctype.inc @@ -3,6 +3,8 @@ %brandDTD; %browserDTD; + +%browserPocketDTD; %baseMenuDTD; diff --git a/browser/base/content/browser-pocket.dtd b/browser/base/content/browser-pocket.dtd new file mode 100644 index 00000000000..96e71271772 --- /dev/null +++ b/browser/base/content/browser-pocket.dtd @@ -0,0 +1,9 @@ + + + + + + diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index f212317f921..669484be7d2 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -177,6 +177,17 @@ nsContextMenu.prototype = { SimpleServiceDiscovery.services.length > 0 && CastingApps.getServicesForVideo(this.target).length > 0; this.setItemAttr("context-castvideo", "disabled", !shouldShowCast); + + let canPocket = false; + if (shouldShow && window.gBrowser && + this.browser.getTabBrowser() == window.gBrowser) { + let uri = this.browser.currentURI; + canPocket = + CustomizableUI.getPlacementOfWidget("pocket-button") && + (uri.schemeIs("http") || uri.schemeIs("https") || + (uri.schemeIs("about") && ReaderMode.getOriginalUrl(uri.spec))); + } + this.showItem("context-pocket", canPocket && window.Pocket && Pocket.isLoggedIn); }, initViewItems: function CM_initViewItems() { @@ -1621,6 +1632,22 @@ nsContextMenu.prototype = { saveDocument(this.browser.contentDocumentAsCPOW); }, + saveToPocket: function CM_saveToPocket() { + let pocketWidget = document.getElementById("pocket-button"); + let placement = CustomizableUI.getPlacementOfWidget("pocket-button"); + if (!placement) + return; + + if (placement.area == CustomizableUI.AREA_PANEL) { + PanelUI.show().then(function() { + pocketWidget = document.getElementById("pocket-button"); + pocketWidget.doCommand(); + }); + } else { + pocketWidget.doCommand(); + } + }, + printFrame: function CM_printFrame() { PrintUtils.print(this.target.ownerDocument.defaultView, this.browser); }, diff --git a/browser/base/content/web-panels.xul b/browser/base/content/web-panels.xul index 4a520befe9b..0b1f84e3f87 100644 --- a/browser/base/content/web-panels.xul +++ b/browser/base/content/web-panels.xul @@ -12,6 +12,8 @@ %browserDTD; + +%browserPocketDTD; %textcontextDTD; ]> diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 7f992ae5600..c23fa66c221 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -76,6 +76,7 @@ browser.jar: * content/browser/browser.js (content/browser.js) * content/browser/browser.xul (content/browser.xul) content/browser/browser-pocket.properties (content/browser-pocket.properties) + content/browser/browser-pocket.dtd (content/browser-pocket.dtd) * content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) * content/browser/chatWindow.xul (content/chatWindow.xul) content/browser/tab-content.js (content/tab-content.js) diff --git a/browser/modules/BrowserUITelemetry.jsm b/browser/modules/BrowserUITelemetry.jsm index a05fff665b7..8611b49bedb 100644 --- a/browser/modules/BrowserUITelemetry.jsm +++ b/browser/modules/BrowserUITelemetry.jsm @@ -661,7 +661,7 @@ this.BrowserUITelemetry = { "copyvideourl", "copyaudiourl", "saveimage", "shareimage", "sendimage", "setDesktopBackground", "viewimageinfo", "viewimagedesc", "savevideo", "sharevideo", "saveaudio", "video-saveimage", "sendvideo", "sendaudio", - "ctp-play", "ctp-hide", "sharepage", "savepage", "markpageMenu", + "ctp-play", "ctp-hide", "sharepage", "savepage", "pocket", "markpageMenu", "viewbgimage", "undo", "cut", "copy", "paste", "delete", "selectall", "keywordfield", "searchselect", "shareselect", "frame", "showonlythisframe", "openframeintab", "openframe", "reloadframe", "bookmarkframe", "saveframe",