Bug 1034036 - Part 1: Merge RecentWindow.jsm and UpdateTopLevelContentWindowIDHelper.jsm into one module called 'BrowserWindowTracker.jsm'. r=dao

MozReview-Commit-ID: 9qzq1aGvjDu
This commit is contained in:
Mike de Boer
2018-04-11 12:05:56 +02:00
parent 4193aa13ff
commit 2271d50b55
33 changed files with 210 additions and 254 deletions

View File

@@ -6,20 +6,16 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.defineModuleGetter(this, "HeadlessShell",
"resource:///modules/HeadlessShell.jsm");
ChromeUtils.defineModuleGetter(this, "LaterRun",
"resource:///modules/LaterRun.jsm");
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.defineModuleGetter(this, "RecentWindow",
"resource:///modules/RecentWindow.jsm");
ChromeUtils.defineModuleGetter(this, "ShellService",
"resource:///modules/ShellService.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
LaterRun: "resource:///modules/LaterRun.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
ShellService: "resource:///modules/ShellService.jsm",
UpdatePing: "resource://gre/modules/UpdatePing.jsm"
});
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
ChromeUtils.defineModuleGetter(this, "UpdatePing",
"resource://gre/modules/UpdatePing.jsm");
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
function shouldLoadURI(aURI) {
if (aURI && !aURI.schemeIs("chrome"))
@@ -677,7 +673,7 @@ function handURIToExistingBrowser(uri, location, cmdLine, forcePrivate, triggeri
// Unless using a private window is forced, open external links in private
// windows only if we're in perma-private mode.
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
var navWin = RecentWindow.getMostRecentBrowserWindow({private: allowPrivate});
var navWin = BrowserWindowTracker.getMostRecentBrowserWindow({private: allowPrivate});
if (!navWin) {
// if we couldn't load it in an existing window, open a new one
openBrowserWindow(cmdLine, uri.spec, null, forcePrivate);
@@ -789,7 +785,7 @@ nsDefaultCommandLineHandler.prototype = {
cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
WindowsUIUtils.inTabletMode) {
// In windows 10 tablet mode, do not create a new window, but reuse the existing one.
let win = RecentWindow.getMostRecentBrowserWindow();
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
if (win) {
win.focus();
return;