Bug 934032 - Add View on Metro feature to Desktop Firefox in Australis. r=bbondy
|
@ -2460,6 +2460,48 @@ function BrowserFullScreen()
|
|||
window.fullScreen = !window.fullScreen;
|
||||
}
|
||||
|
||||
function _checkDefaultAndSwitchToMetro() {
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
let shell = Components.classes["@mozilla.org/browser/shell-service;1"].
|
||||
getService(Components.interfaces.nsIShellService);
|
||||
let isDefault = shell.isDefaultBrowser(false, false);
|
||||
|
||||
if (isDefault) {
|
||||
let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
|
||||
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
||||
Components.interfaces.nsIAppStartup.eRestartTouchEnvironment);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
function SwitchToMetro() {
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
if (this._checkDefaultAndSwitchToMetro()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let shell = Components.classes["@mozilla.org/browser/shell-service;1"].
|
||||
getService(Components.interfaces.nsIShellService);
|
||||
|
||||
shell.setDefaultBrowser(false, false);
|
||||
|
||||
let intervalID = window.setInterval(this._checkDefaultAndSwitchToMetro, 1000);
|
||||
window.setTimeout(function() { window.clearInterval(intervalID); }, 10000);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
function onFullScreen(event) {
|
||||
FullScreen.toggle(event);
|
||||
}
|
||||
|
|
|
@ -140,9 +140,27 @@ let CustomizableUIInternal = {
|
|||
"history-panelmenu",
|
||||
"fullscreen-button",
|
||||
"find-button",
|
||||
"preferences-button",
|
||||
"add-ons-button",
|
||||
"preferences-button"
|
||||
];
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
// Show switch-to-metro-button if in Windows 8.
|
||||
let isMetroCapable = false;
|
||||
try {
|
||||
// Windows 8 is version 6.2.
|
||||
let version = Cc["@mozilla.org/system-info;1"]
|
||||
.getService(Ci.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
isMetroCapable = (parseFloat(version) >= 6.2);
|
||||
} catch (ex) { }
|
||||
|
||||
if (isMetroCapable) {
|
||||
panelPlacements.push("switch-to-metro-button");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
let showCharacterEncoding = Services.prefs.getComplexValue(
|
||||
"browser.menu.showCharacterEncoding",
|
||||
Ci.nsIPrefLocalizedString
|
||||
|
@ -966,6 +984,12 @@ let CustomizableUIInternal = {
|
|||
"' not found!");
|
||||
}
|
||||
}
|
||||
|
||||
if (aWidget.id == "switch-to-metro-button") {
|
||||
let brandBundle = aDocument.getElementById("bundle_brand");
|
||||
let brandShortName = brandBundle.getString("brandShortName");
|
||||
additionalTooltipArguments = [brandShortName];
|
||||
}
|
||||
let tooltip = this.getLocalizedProperty(aWidget, "tooltiptext", additionalTooltipArguments);
|
||||
node.setAttribute("tooltiptext", tooltip);
|
||||
node.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
|
||||
|
|
|
@ -259,6 +259,18 @@ const CustomizableWidgets = [{
|
|||
aEvent.target.removeEventListener("command",
|
||||
win.PanelUI.onCommandHandler);
|
||||
}
|
||||
}, {
|
||||
id: "switch-to-metro-button",
|
||||
removable: true,
|
||||
defaultArea: CustomizableUI.AREA_PANEL,
|
||||
onCommand: function(aEvent) {
|
||||
let win = aEvent.target &&
|
||||
aEvent.target.ownerDocument &&
|
||||
aEvent.target.ownerDocument.defaultView;
|
||||
if (win && typeof win.SwitchToMetro == "function") {
|
||||
win.SwitchToMetro();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
id: "add-ons-button",
|
||||
removable: true,
|
||||
|
|
|
@ -31,6 +31,10 @@ add-ons-button.label = Add-ons
|
|||
# LOCALIZATION NOTE(add-ons-button.tooltiptext): %S is the keyboard shortcut
|
||||
add-ons-button.tooltiptext = Add-ons Manager (%S)
|
||||
|
||||
switch-to-metro-button.label = Metro Mode
|
||||
# LOCALIZATION NOTE(switch-to-metro-button.tooltiptext): %S is the brand short name
|
||||
switch-to-metro-button.tooltiptext = Relaunch in Windows 8 style %S
|
||||
|
||||
preferences-button.label = Preferences
|
||||
# LOCALIZATION NOTE (preferences-button.tooltiptext): Use the unicode ellipsis char,
|
||||
# \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%filter substitution
|
||||
|
||||
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button
|
||||
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button
|
||||
%define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]),.overflowedItem)
|
||||
|
|
|
@ -30,6 +30,11 @@ toolbarpaletteitem[place="palette"] > #downloads-button {
|
|||
-moz-image-region: rect(0px, 256px, 32px, 224px);
|
||||
}
|
||||
|
||||
#switch-to-metro-button[cui-areatype="menu-panel"],
|
||||
toolbarpaletteitem[place="palette"] > #switch-to-metro-button {
|
||||
-moz-image-region: rect(0px, 800px, 32px, 768px);
|
||||
}
|
||||
|
||||
#add-ons-button[cui-areatype="menu-panel"],
|
||||
toolbarpaletteitem[place="palette"] > #add-ons-button {
|
||||
-moz-image-region: rect(0px, 288px, 32px, 256px);
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
-moz-image-region: rect(0, 216px, 18px, 198px);
|
||||
}
|
||||
|
||||
#switch-to-metro-button[cui-areatype="toolbar"] {
|
||||
-moz-image-region: rect(0, 648px, 18px, 630px);
|
||||
}
|
||||
|
||||
#open-file-button[cui-areatype="toolbar"] {
|
||||
-moz-image-region: rect(0, 234px, 18px, 216px);
|
||||
}
|
||||
|
|
Двоичные данные
browser/themes/windows/Toolbar-aero.png
До Ширина: | Высота: | Размер: 13 KiB После Ширина: | Высота: | Размер: 23 KiB |
Двоичные данные
browser/themes/windows/Toolbar-inverted-aero.png
До Ширина: | Высота: | Размер: 9.1 KiB После Ширина: | Высота: | Размер: 31 KiB |
Двоичные данные
browser/themes/windows/Toolbar-inverted.png
До Ширина: | Высота: | Размер: 9.1 KiB После Ширина: | Высота: | Размер: 31 KiB |
Двоичные данные
browser/themes/windows/Toolbar-lunaSilver.png
До Ширина: | Высота: | Размер: 13 KiB После Ширина: | Высота: | Размер: 23 KiB |
Двоичные данные
browser/themes/windows/Toolbar.png
До Ширина: | Высота: | Размер: 14 KiB После Ширина: | Высота: | Размер: 23 KiB |
Двоичные данные
browser/themes/windows/menuPanel-aero.png
До Ширина: | Высота: | Размер: 25 KiB После Ширина: | Высота: | Размер: 27 KiB |
Двоичные данные
browser/themes/windows/menuPanel.png
До Ширина: | Высота: | Размер: 20 KiB После Ширина: | Высота: | Размер: 27 KiB |
|
@ -270,7 +270,14 @@ nsAppStartup::Run(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
return (mRestart || mRestartTouchEnvironment) ? NS_SUCCESS_RESTART_APP : NS_OK;
|
||||
nsresult retval = NS_OK;
|
||||
if (mRestartTouchEnvironment) {
|
||||
retval = NS_SUCCESS_RESTART_METRO_APP;
|
||||
} else if (mRestart) {
|
||||
retval = NS_SUCCESS_RESTART_APP;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ interface nsIAppStartup : nsISupports
|
|||
* @returnCode NS_SUCCESS_RESTART_APP
|
||||
* This return code indicates that the application should be
|
||||
* restarted because quit was called with the eRestart flag.
|
||||
|
||||
* @returnCode NS_SUCCESS_RESTART_METRO_APP
|
||||
* This return code indicates that the application should be
|
||||
* restarted in metro because quit was called with the
|
||||
* eRestartTouchEnviroment flag.
|
||||
*/
|
||||
void run();
|
||||
|
||||
|
|
|
@ -127,6 +127,10 @@
|
|||
#include "nsXREDirProvider.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
#include "updatehelper.h"
|
||||
#endif
|
||||
|
||||
#include "nsINIParser.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
|
@ -4047,12 +4051,18 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
|
||||
// Check for an application initiated restart. This is one that
|
||||
// corresponds to nsIAppStartup.quit(eRestart)
|
||||
if (rv == NS_SUCCESS_RESTART_APP) {
|
||||
if (rv == NS_SUCCESS_RESTART_APP || rv == NS_SUCCESS_RESTART_METRO_APP) {
|
||||
appInitiatedRestart = true;
|
||||
|
||||
// We have an application restart don't do any shutdown checks here
|
||||
// In particular we don't want to poison IO for checking late-writes.
|
||||
gShutdownChecks = SCM_NOTHING;
|
||||
|
||||
#if defined(MOZ_METRO) && defined(XP_WIN)
|
||||
if (rv == NS_SUCCESS_RESTART_METRO_APP) {
|
||||
LaunchDefaultMetroBrowser();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!mShuttingDown) {
|
||||
|
|
|
@ -856,6 +856,7 @@
|
|||
* the application should be restarted. This condition corresponds to the
|
||||
* case in which nsIAppStartup::Quit was called with the eRestart flag. */
|
||||
ERROR(NS_SUCCESS_RESTART_APP, SUCCESS(1)),
|
||||
ERROR(NS_SUCCESS_RESTART_METRO_APP, SUCCESS(1)),
|
||||
ERROR(NS_SUCCESS_UNORM_NOTFOUND, SUCCESS(17)),
|
||||
|
||||
|
||||
|
|