зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1165321 - focus existing window if Firefox is already open in tablet mode, r=jaws
--HG-- extra : commitid : E96QcAy8k5s extra : rebase_source : b79523b4d46f8b4a91015bab28226f3bae014794
This commit is contained in:
Родитель
6edc702182
Коммит
7fcc460681
|
@ -37,10 +37,13 @@ XPIDL_MODULE = 'browsercompsbase'
|
|||
|
||||
EXTRA_PP_COMPONENTS += [
|
||||
'BrowserComponents.manifest',
|
||||
'nsBrowserContentHandler.js',
|
||||
'nsBrowserGlue.js',
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'nsBrowserContentHandler.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'distribution.js',
|
||||
]
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
|
||||
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
||||
|
||||
const nsISupports = Components.interfaces.nsISupports;
|
||||
|
||||
|
@ -452,7 +455,7 @@ nsBrowserContentHandler.prototype = {
|
|||
cmdLine.preventDefault = true;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (AppConstants.platform == "win") {
|
||||
// Handle "? searchterm" for Windows Vista start menu integration
|
||||
for (var i = cmdLine.length - 1; i >= 0; --i) {
|
||||
var param = cmdLine.getArgument(i);
|
||||
|
@ -464,19 +467,23 @@ nsBrowserContentHandler.prototype = {
|
|||
doSearch(searchParam, cmdLine);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
},
|
||||
|
||||
helpInfo : " --browser Open a browser window.\n" +
|
||||
get helpInfo() {
|
||||
let info =
|
||||
" --browser Open a browser window.\n" +
|
||||
" --new-window <url> Open <url> in a new window.\n" +
|
||||
" --new-tab <url> Open <url> in a new tab.\n" +
|
||||
" --private-window <url> Open <url> in a new private window.\n" +
|
||||
#ifdef XP_WIN
|
||||
" --preferences Open Options dialog.\n" +
|
||||
#else
|
||||
" --preferences Open Preferences dialog.\n" +
|
||||
#endif
|
||||
" --search <term> Search <term> with your default search engine.\n",
|
||||
" --private-window <url> Open <url> in a new private window.\n";
|
||||
if (AppConstants.platform == "win") {
|
||||
info += " --preferences Open Options dialog.\n";
|
||||
} else {
|
||||
info += " --preferences Open Preferences dialog.\n";
|
||||
}
|
||||
info += " --search <term> Search <term> with your default search engine.\n";
|
||||
return info;
|
||||
},
|
||||
|
||||
/* nsIBrowserHandler */
|
||||
|
||||
|
@ -687,15 +694,13 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
return this;
|
||||
},
|
||||
|
||||
#ifdef XP_WIN
|
||||
_haveProfile: false,
|
||||
#endif
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle : function dch_handle(cmdLine) {
|
||||
var urilist = [];
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (AppConstants.platform == "win") {
|
||||
// If we don't have a profile selected yet (e.g. the Profile Manager is
|
||||
// displayed) we will crash if we open an url and then select a profile. To
|
||||
// prevent this handle all url command line flags and set the command line's
|
||||
|
@ -715,7 +720,7 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
cmdLine.preventDefault = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
try {
|
||||
var ar;
|
||||
|
@ -767,6 +772,16 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
|
||||
}
|
||||
else if (!cmdLine.preventDefault) {
|
||||
if (AppConstants.isPlatformAndVersionAtLeast("win", "10") &&
|
||||
cmdLine.state != 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();
|
||||
if (win) {
|
||||
win.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Passing defaultArgs, so use NO_EXTERNAL_URIS
|
||||
openWindow(null, gBrowserContentHandler.chromeURL, "_blank",
|
||||
"chrome,dialog=no,all" + gBrowserContentHandler.getFeatures(cmdLine),
|
||||
|
|
Загрузка…
Ссылка в новой задаче