Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
Roy Tam 2020-02-07 09:41:49 +08:00
commit a60c742310
14 changed files with 33 additions and 308 deletions

View file

@ -238,11 +238,6 @@
label="&emailVideoCmd.label;"
accesskey="&emailVideoCmd.accesskey;"
oncommand="gContextMenu.sendMedia();"/>
<menu id="context-castvideo"
label="&castVideoCmd.label;"
accesskey="&castVideoCmd.accesskey;">
<menupopup id="context-castvideo-popup" onpopupshowing="gContextMenu.populateCastVideoMenu(this)"/>
</menu>
<menuitem id="context-sendaudio"
label="&emailAudioCmd.label;"
accesskey="&emailAudioCmd.accesskey;"

View file

@ -443,8 +443,7 @@
<menu id="tools-menu"
label="&toolsMenu.label;"
accesskey="&toolsMenu.accesskey;"
onpopupshowing="mirrorShow(this)">
accesskey="&toolsMenu.accesskey;">
<menupopup id="menu_ToolsPopup"
#ifdef MOZ_SERVICES_SYNC
onpopupshowing="gSyncUI.updateUI();"
@ -493,13 +492,6 @@
key="key_viewInfo"
#endif
command="View:PageInfo"/>
<menu id="menu_mirrorTabCmd"
hidden="true"
accesskey="&mirrorTabCmd.accesskey;"
label="&mirrorTabCmd.label;">
<menupopup id="menu_mirrorTab-popup"
onpopupshowing="populateMirrorTabMenu(this)"/>
</menu>
<menuseparator id="prefSep"/>
<menuitem id="menu_preferences"
label="&preferencesCmd2.label;"

View file

@ -18,7 +18,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["AppConstants", "resource://gre/modules/AppConstants.jsm"],
["BrowserUsageTelemetry", "resource:///modules/BrowserUsageTelemetry.jsm"],
["BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"],
["CastingApps", "resource:///modules/CastingApps.jsm"],
["CharsetMenu", "resource://gre/modules/CharsetMenu.jsm"],
["Color", "resource://gre/modules/Color.jsm"],
["ContentSearch", "resource:///modules/ContentSearch.jsm"],
@ -41,7 +40,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["RecentWindow", "resource:///modules/RecentWindow.jsm"],
["SessionStore", "resource:///modules/sessionstore/SessionStore.jsm"],
["ShortcutUtils", "resource://gre/modules/ShortcutUtils.jsm"],
["SimpleServiceDiscovery", "resource://gre/modules/SimpleServiceDiscovery.jsm"],
["SitePermissions", "resource:///modules/SitePermissions.jsm"],
["TabCrashHandler", "resource:///modules/ContentCrashHandlers.jsm"],
["Task", "resource://gre/modules/Task.jsm"],
@ -3023,35 +3021,6 @@ function BrowserFullScreen()
window.fullScreen = !window.fullScreen;
}
function mirrorShow(popup) {
let services = [];
if (Services.prefs.getBoolPref("browser.casting.enabled")) {
services = CastingApps.getServicesForMirroring();
}
popup.ownerDocument.getElementById("menu_mirrorTabCmd").hidden = !services.length;
}
function mirrorMenuItemClicked(event) {
gBrowser.selectedBrowser.messageManager.sendAsyncMessage("SecondScreen:tab-mirror",
{service: event.originalTarget._service});
}
function populateMirrorTabMenu(popup) {
popup.innerHTML = null;
if (!Services.prefs.getBoolPref("browser.casting.enabled")) {
return;
}
let doc = popup.ownerDocument;
let services = CastingApps.getServicesForMirroring();
services.forEach(service => {
let item = doc.createElement("menuitem");
item.setAttribute("label", service.friendlyName);
item._service = service;
item.addEventListener("command", mirrorMenuItemClicked);
popup.appendChild(item);
});
}
function getWebNavigation()
{
return gBrowser.webNavigation;

View file

@ -217,21 +217,10 @@ nsContextMenu.prototype = {
// Send media URL (but not for canvas, since it's a big data: URL)
this.showItem("context-sendimage", this.onImage);
this.showItem("context-sendvideo", this.onVideo);
this.showItem("context-castvideo", this.onVideo);
this.showItem("context-sendaudio", this.onAudio);
let mediaIsBlob = this.mediaURL.startsWith("blob:");
this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL || mediaIsBlob);
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
let shouldShowCast = Services.prefs.getBoolPref("browser.casting.enabled");
// getServicesForVideo alone would be sufficient here (it depends on
// SimpleServiceDiscovery.services), but SimpleServiceDiscovery is guaranteed
// to be already loaded, since we load it on startup in nsBrowserGlue,
// and CastingApps isn't, so check SimpleServiceDiscovery.services first
// to avoid needing to load CastingApps.jsm if we don't need to.
shouldShowCast = shouldShowCast && this.mediaURL &&
SimpleServiceDiscovery.services.length > 0 &&
CastingApps.getServicesForVideo(this.target).length > 0;
this.setItemAttr("context-castvideo", "disabled", !shouldShowCast);
},
initViewItems: function CM_initViewItems() {
@ -1434,25 +1423,6 @@ nsContextMenu.prototype = {
MailIntegration.sendMessage(this.mediaURL, "");
},
castVideo: function() {
CastingApps.openExternal(this.target, window);
},
populateCastVideoMenu: function(popup) {
let videoEl = this.target;
popup.innerHTML = null;
let doc = popup.ownerDocument;
let services = CastingApps.getServicesForVideo(videoEl);
services.forEach(service => {
let item = doc.createElement("menuitem");
item.setAttribute("label", service.friendlyName);
item.addEventListener("command", event => {
CastingApps.sendVideoToService(videoEl, service);
});
popup.appendChild(item);
});
},
playPlugin: function() {
gPluginHandler.contextMenuCommand(this.browser, this.target, "play");
},

View file

@ -25,21 +25,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Readerable",
"resource://gre/modules/Readerable.jsm");
XPCOMUtils.defineLazyGetter(this, "SimpleServiceDiscovery", function() {
let ssdp = Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm", {}).SimpleServiceDiscovery;
// Register targets
ssdp.registerDevice({
id: "roku:ecp",
target: "roku:ecp",
factory: function(aService) {
Cu.import("resource://gre/modules/RokuApp.jsm");
return new RokuApp(aService);
},
types: ["video/mp4"],
extensions: ["mp4"]
});
return ssdp;
});
// TabChildGlobal
var global = this;
@ -94,19 +79,6 @@ addMessageListener("MixedContent:ReenableProtection", function() {
docShell.mixedContentChannel = null;
});
addMessageListener("SecondScreen:tab-mirror", function(message) {
if (!Services.prefs.getBoolPref("browser.casting.enabled")) {
return;
}
let app = SimpleServiceDiscovery.findAppForService(message.data.service);
if (app) {
let width = content.innerWidth;
let height = content.innerHeight;
let viewport = {cssWidth: width, cssHeight: height, width: width, height: height};
app.mirror(function() {}, content, viewport, function() {}, content);
}
});
var AboutHomeListener = {
init: function(chromeGlobal) {
chromeGlobal.addEventListener('AboutHomeLoad', this, false, true);