Bug 1472491: Part 5h - Add LightWeightThemeChild actor. r=felipe

MozReview-Commit-ID: CmUbpPZxNeS

--HG--
rename : browser/modules/LightWeightThemeWebInstallListener.jsm => browser/actors/LightWeightThemeInstallChild.jsm
extra : rebase_source : 4ddca3d174896be4552ba8b37354a9b0b5fb3ade
This commit is contained in:
Kris Maglione 2018-07-29 20:34:21 -07:00
parent 44b124801c
commit 561a33134b
5 changed files with 20 additions and 20 deletions

View File

@ -2,13 +2,13 @@
* 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 EXPORTED_SYMBOLS = ["LightWeightThemeWebInstallListener"];
var EXPORTED_SYMBOLS = ["LightWeightThemeInstallChild"];
var LightWeightThemeWebInstallListener = {
_previewWindow: null,
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class LightWeightThemeInstallChild extends ActorChild {
handleEvent(event) {
let mm = getMessageManagerForContent(event.target.ownerGlobal);
let {mm} = this;
switch (event.type) {
case "InstallBrowserTheme": {
mm.sendAsyncMessage("LightWeightThemeWebInstaller:Install", {
@ -42,14 +42,10 @@ var LightWeightThemeWebInstallListener = {
break;
}
}
},
}
_resetPreviewWindow() {
this._previewWindow.removeEventListener("pagehide", this, true);
this._previewWindow = null;
}
};
function getMessageManagerForContent(content) {
return content.docShell.messageManager;
}

View File

@ -4,6 +4,9 @@
# 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/.
with Files("LightWeightThemeInstallChild.jsm"):
BUG_COMPONENT = ("Firefox", "Theme")
with Files("PageInfoChild.jsm"):
BUG_COMPONENT = ("Firefox", "Page Info Window")
@ -16,6 +19,7 @@ FINAL_TARGET_FILES.actors += [
'ClickHandlerChild.jsm',
'ContentSearchChild.jsm',
'ContextMenuChild.jsm',
'LightWeightThemeInstallChild.jsm',
'PageInfoChild.jsm',
'PageStyleChild.jsm',
]

View File

@ -44,9 +44,6 @@ XPCOMUtils.defineLazyProxy(this, "formSubmitObserver", () => {
QueryInterface: ChromeUtils.generateQI([Ci.nsIFormSubmitObserver, Ci.nsISupportsWeakReference])
});
XPCOMUtils.defineLazyProxy(this, "LightWeightThemeWebInstallListener",
"resource:///modules/LightWeightThemeWebInstallListener.jsm");
Services.obs.addObserver(formSubmitObserver, "invalidformsubmit", true);
// NOTE: Much of this logic is duplicated in BrowserCLH.js for Android.
@ -266,10 +263,6 @@ var PageMetadataMessenger = {
};
PageMetadataMessenger.init();
addEventListener("InstallBrowserTheme", LightWeightThemeWebInstallListener, false, true);
addEventListener("PreviewBrowserTheme", LightWeightThemeWebInstallListener, false, true);
addEventListener("ResetBrowserThemePreview", LightWeightThemeWebInstallListener, false, true);
let OfflineApps = {
_docId: 0,
_docIdMap: new Map(),

View File

@ -87,6 +87,17 @@ let ACTORS = {
},
},
LightWeightThemeInstall: {
child: {
module: "resource:///actors/LightWeightThemeInstallChild.jsm",
events: {
"InstallBrowserTheme": {wantUntrusted: true},
"PreviewBrowserTheme": {wantUntrusted: true},
"ResetBrowserThemePreview": {wantUntrusted: true},
},
},
},
PageInfo: {
child: {
module: "resource:///actors/PageInfoChild.jsm",

View File

@ -67,9 +67,6 @@ with Files("LaterRun.jsm"):
with Files("LightweightThemeChildHelper.jsm"):
BUG_COMPONENT = ("WebExtensions", "Themes")
with Files("LightWeightThemeWebInstallListener.jsm"):
BUG_COMPONENT = ("Firefox", "Theme")
with Files("OpenInTabsUtils.jsm"):
BUG_COMPONENT = ("Firefox", "Tabbed Browser")
@ -146,7 +143,6 @@ EXTRA_JS_MODULES += [
'HomePage.jsm',
'LaterRun.jsm',
'LightweightThemeChildHelper.jsm',
'LightWeightThemeWebInstallListener.jsm',
'NetErrorContent.jsm',
'OpenInTabsUtils.jsm',
'PageActions.jsm',