diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index cff50c593d6..f8f253cd158 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -1116,6 +1116,14 @@ var NativeWindow = { NativeWindow.toast.show(label, "short"); }); + this.add(Strings.browser.GetStringFromName("contextmenu.copyLink"), + this.linkCopyableContext, + function(aTarget) { + let url = NativeWindow.contextmenus._getLinkURL(aTarget); + let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper); + clipboard.copyString(url); + }); + this.add(Strings.browser.GetStringFromName("contextmenu.shareLink"), this.linkShareableContext, function(aTarget) { @@ -1237,6 +1245,18 @@ var NativeWindow = { } }, + linkCopyableContext: { + matches: function linkCopyableContextMatches(aElement) { + let uri = NativeWindow.contextmenus._getLink(aElement); + if (uri) { + let scheme = uri.scheme; + let dontCopy = /^(mailto|tel)$/; + return (scheme && !dontCopy.test(scheme)); + } + return false; + } + }, + linkShareableContext: { matches: function linkShareableContextMatches(aElement) { let uri = NativeWindow.contextmenus._getLink(aElement); diff --git a/mobile/android/locales/en-US/chrome/browser.properties b/mobile/android/locales/en-US/chrome/browser.properties index c031174c81f..8547b0c7e91 100644 --- a/mobile/android/locales/en-US/chrome/browser.properties +++ b/mobile/android/locales/en-US/chrome/browser.properties @@ -209,6 +209,7 @@ selectionHelper.textCopied=Text copied to clipboard # Context menu contextmenu.openInNewTab=Open Link in New Tab contextmenu.share=Share +contextmenu.copyLink=Copy Link contextmenu.shareLink=Share Link contextmenu.bookmarkLink=Bookmark Link contextmenu.changeInputMethod=Select Input Method