diff options
-rw-r--r-- | chrome/app/chrome_command_ids.h | 4 | ||||
-rw-r--r-- | chrome/app/chrome_dll.rc | 1 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 20 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_process_platform_part_aurawin.cc | 2 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util_win.cc | 6 | ||||
-rw-r--r-- | chrome/browser/lifetime/application_lifetime.h | 4 | ||||
-rw-r--r-- | chrome/browser/plugins/plugin_infobar_delegates.cc | 9 | ||||
-rw-r--r-- | chrome/browser/ui/apps/apps_metro_handler_win.cc | 24 | ||||
-rw-r--r-- | chrome/browser/ui/apps/apps_metro_handler_win.h | 8 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_util.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_util.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/browser_command_controller.cc | 40 | ||||
-rw-r--r-- | chrome/browser/ui/toolbar/wrench_menu_model.cc | 38 | ||||
-rw-r--r-- | tools/metrics/actions/actions.xml | 30 | ||||
-rw-r--r-- | win8/delegate_execute/command_execute_impl.h | 3 | ||||
-rw-r--r-- | win8/delegate_execute/delegate_execute.cc | 68 | ||||
-rw-r--r-- | win8/delegate_execute/delegate_execute_operation.cc | 19 |
18 files changed, 169 insertions, 122 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 80f66fe..c680752 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -65,9 +65,9 @@ #define IDC_PRESENTATION_MODE 34039 #define IDC_METRO_SNAP_ENABLE 34040 #define IDC_METRO_SNAP_DISABLE 34041 -#define IDC_WIN8_DESKTOP_RESTART 34042 +#define IDC_WIN_DESKTOP_RESTART 34042 #define IDC_WIN8_METRO_RESTART 34043 -#define IDC_TOGGLE_ASH_DESKTOP 34044 +#define IDC_WIN_CHROMEOS_RESTART 34044 #define IDC_WINDOW_MENU 34045 #define IDC_MINIMIZE_WINDOW 34046 #define IDC_MAXIMIZE_WINDOW 34047 diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc index 8537801..4892c4d 100644 --- a/chrome/app/chrome_dll.rc +++ b/chrome/app/chrome_dll.rc @@ -123,7 +123,6 @@ BEGIN VK_OEM_PLUS, IDC_ZOOM_PLUS, VIRTKEY, CONTROL VK_OEM_PLUS, IDC_ZOOM_PLUS, VIRTKEY, CONTROL, SHIFT VK_ADD, IDC_ZOOM_PLUS, VIRTKEY, CONTROL - "A", IDC_TOGGLE_ASH_DESKTOP, VIRTKEY, CONTROL, SHIFT END #ifdef APSTUDIO_INVOKED diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 44ce2eb..e083e68 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -13643,12 +13643,6 @@ Do you accept? <message name="IDS_GTALK_REMOTING_CONTINUE_DIALOG_MESSAGE" desc="Message of the dialog box asking user's permission to continue Hangouts Remote Desktop"> You are being helped. Do you want to continue? </message> - <message name="IDS_OPEN_ASH_DESKTOP" desc="The text label of the Open Ash desktop menu item"> - Open Ash desktop - </message> - <message name="IDS_CLOSE_ASH_DESKTOP" desc="The text label of the Close Ash desktop menu item"> - Close Ash desktop - </message> </if> <!-- Panel windows --> @@ -13836,11 +13830,11 @@ Do you accept? desc="Title for notification displayed when a download request is completed"> Download complete notification </message> - <message name="IDS_WIN8_DESKTOP_OPEN" + <message name="IDS_WIN_DESKTOP_OPEN" desc="Text for the infobar button to open Chrome in desktop mode."> Open Chrome on the desktop </message> - <message name="IDS_WIN8_DESKTOP_RESTART" + <message name="IDS_WIN_DESKTOP_RESTART" desc="Text for the menu item to restart chrome in desktop mode. Aplies to Windows 8 only"> Relaunch Chrome on the desktop </message> @@ -13852,7 +13846,15 @@ Do you accept? desc="Modal message box prompt shown to the user after requesting to relaunch in Windows 8 mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> Relaunching in Windows 8 mode will close and relaunch your Chrome apps. </message> - <message name="IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP" + <message name="IDS_WIN_CHROMEOS_RESTART" + desc="Text for the menu item to restart chrome in chrome os. Aplies to Windows 7 only"> + Relaunch Chrome in Chrome OS mode + </message> + <message name="IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS" + desc="Modal message box prompt shown to the user after requesting to relaunch in Windows chrome os mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> + Relaunching in Chrome OS mode will close and relaunch your Chrome apps. + </message> + <message name="IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP" desc="Modal message box prompt shown to the user after requesting to relaunch in Desktop mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> Relaunching in Desktop mode will close and relaunch your Chrome apps. </message> diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 701fab0..06301fd 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -783,7 +783,7 @@ void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kEulaAccepted, false); #endif // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_IOS) #if defined(OS_WIN) - if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + if (base::win::GetVersion() >= base::win::VERSION_WIN7) { registry->RegisterStringPref(prefs::kRelaunchMode, upgrade_util::kRelaunchModeDefault); } diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc index 356ffb4..7bb344b 100644 --- a/chrome/browser/browser_process_platform_part_aurawin.cc +++ b/chrome/browser/browser_process_platform_part_aurawin.cc @@ -22,7 +22,7 @@ #include "ui/aura/remote_window_tree_host_win.h" BrowserProcessPlatformPart::BrowserProcessPlatformPart() { - if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + if (base::win::GetVersion() >= base::win::VERSION_WIN7) { // Tell metro viewer to close when we are shutting down. registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc index 5e33c5e..f9557ee 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -136,11 +136,15 @@ bool RelaunchChromeHelper(const CommandLine& command_line, chrome_exe_command_line.SetProgram( chrome_exe.DirName().Append(installer::kChromeExe)); - if (base::win::GetVersion() < base::win::VERSION_WIN8) + if (base::win::GetVersion() < base::win::VERSION_WIN8 && + relaunch_mode != RELAUNCH_MODE_METRO && + relaunch_mode != RELAUNCH_MODE_DESKTOP) return base::LaunchProcess(chrome_exe_command_line, base::LaunchOptions(), NULL); // On Windows 8 we always use the delegate_execute for re-launching chrome. + // On Windows 7 we use delegate_execute for re-launching chrome into Windows + // ASH. // // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- // activate chrome via ShellExecute which will wait until we exit. Since diff --git a/chrome/browser/lifetime/application_lifetime.h b/chrome/browser/lifetime/application_lifetime.h index 0a5db429..bc28f52 100644 --- a/chrome/browser/lifetime/application_lifetime.h +++ b/chrome/browser/lifetime/application_lifetime.h @@ -41,11 +41,13 @@ enum AshExecutionStatus { // activating desktop. void ActivateDesktopHelper(AshExecutionStatus ash_execution_status); -// Windows 8 specific: Like AttemptRestart but if chrome is running +// Windows 7/8 specific: Like AttemptRestart but if chrome is running // in desktop mode it starts in metro mode and vice-versa. The switching like // the restarting is controlled by a preference. void AttemptRestartWithModeSwitch(); void AttemptRestartToDesktopMode(); +// Launches Chrome into Windows 8 metro mode on Windows 8. On Windows 7 it +// launches Chrome into Windows ASH. void AttemptRestartToMetroMode(); #endif diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc index 3bfd2c4..d67c480 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.cc +++ b/chrome/browser/plugins/plugin_infobar_delegates.cc @@ -482,15 +482,9 @@ int PluginMetroModeInfoBarDelegate::GetButtons() const { base::string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { -#if defined(USE_AURA) && defined(USE_ASH) - return l10n_util::GetStringUTF16(IDS_WIN8_DESKTOP_RESTART); -#else - return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? - IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_DESKTOP_OPEN); -#endif + return l10n_util::GetStringUTF16(IDS_WIN_DESKTOP_RESTART); } -#if defined(USE_AURA) && defined(USE_ASH) void LaunchDesktopInstanceHelper(const base::string16& url) { base::FilePath exe_path; if (!PathService::Get(base::FILE_EXE, &exe_path)) @@ -504,7 +498,6 @@ void LaunchDesktopInstanceHelper(const base::string16& url) { aura::RemoteWindowTreeHostWin::Instance()->HandleOpenURLOnDesktop( shortcut_path, url); } -#endif bool PluginMetroModeInfoBarDelegate::Accept() { chrome::AttemptRestartToDesktopMode(); diff --git a/chrome/browser/ui/apps/apps_metro_handler_win.cc b/chrome/browser/ui/apps/apps_metro_handler_win.cc index ff46fa2..8d212e8 100644 --- a/chrome/browser/ui/apps/apps_metro_handler_win.cc +++ b/chrome/browser/ui/apps/apps_metro_handler_win.cc @@ -12,18 +12,28 @@ #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -bool VerifyMetroSwitchForApps(gfx::NativeWindow parent_window, - int win8_restart_command_id) { - DCHECK(win8_restart_command_id == IDC_WIN8_DESKTOP_RESTART || - win8_restart_command_id == IDC_WIN8_METRO_RESTART); +bool VerifyASHSwitchForApps(gfx::NativeWindow parent_window, + int win_restart_command_id) { + DCHECK(win_restart_command_id == IDC_WIN_DESKTOP_RESTART || + win_restart_command_id == IDC_WIN8_METRO_RESTART || + win_restart_command_id == IDC_WIN_CHROMEOS_RESTART); if (!apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile( apps::AppWindow::WINDOW_TYPE_DEFAULT)) { return true; } - int string_id = win8_restart_command_id == IDC_WIN8_METRO_RESTART ? - IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO : - IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP; + int string_id = 0; + switch (win_restart_command_id) { + case IDC_WIN8_METRO_RESTART: + string_id = IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO; + break; + case IDC_WIN_CHROMEOS_RESTART: + string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS; + break; + default: + string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP; + break; + } chrome::MessageBoxResult result = chrome::ShowMessageBox( parent_window, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), diff --git a/chrome/browser/ui/apps/apps_metro_handler_win.h b/chrome/browser/ui/apps/apps_metro_handler_win.h index 8dc8b1c..19a0600 100644 --- a/chrome/browser/ui/apps/apps_metro_handler_win.h +++ b/chrome/browser/ui/apps/apps_metro_handler_win.h @@ -9,9 +9,9 @@ // Check if there are apps running and if not, return true. Otherwise, Show a // modal dialog on |parent| asking whether the user is OK with their packaged -// apps closing, in order to relaunch to or from Metro mode. Returns true if the -// user clicks OK. -bool VerifyMetroSwitchForApps(gfx::NativeWindow parent, - int win8_restart_command_id); +// apps closing, in order to relaunch to or from Windows ASH mode. Returns true +// if the user clicks OK. +bool VerifyASHSwitchForApps(gfx::NativeWindow parent, + int win_restart_command_id); #endif // CHROME_BROWSER_UI_APPS_APPS_METRO_HANDLER_WIN_H_ diff --git a/chrome/browser/ui/ash/ash_util.cc b/chrome/browser/ui/ash/ash_util.cc index f2670de..3012ab3 100644 --- a/chrome/browser/ui/ash/ash_util.cc +++ b/chrome/browser/ui/ash/ash_util.cc @@ -36,14 +36,4 @@ bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { return IsNativeViewInAsh(native_window); } -void ToggleAshDesktop() { - if (chrome::HOST_DESKTOP_TYPE_ASH == chrome::HOST_DESKTOP_TYPE_NATIVE) - return; - - if (!ash::Shell::HasInstance()) - OpenAsh(gfx::kNullAcceleratedWidget); - else - CloseAsh(); -} - } // namespace chrome diff --git a/chrome/browser/ui/ash/ash_util.h b/chrome/browser/ui/ash/ash_util.h index 4de12aa..6e0cb9e 100644 --- a/chrome/browser/ui/ash/ash_util.h +++ b/chrome/browser/ui/ash/ash_util.h @@ -14,9 +14,6 @@ namespace chrome { bool IsNativeViewInAsh(gfx::NativeView native_view); bool IsNativeWindowInAsh(gfx::NativeWindow native_window); -// Opens the Ash desktop if it's closed; otherwise, closes it. -void ToggleAshDesktop(); - } // namespace chrome #endif // CHROME_BROWSER_UI_ASH_ASH_UTIL_H_ diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index c083db2..cc041b4 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -461,12 +461,6 @@ void BrowserCommandController::ExecuteCommandWithDisposition( #endif break; -#if defined(USE_ASH) - case IDC_TOGGLE_ASH_DESKTOP: - chrome::ToggleAshDesktop(); - break; -#endif - #if defined(OS_CHROMEOS) case IDC_VISIT_DESKTOP_OF_LRU_USER_2: case IDC_VISIT_DESKTOP_OF_LRU_USER_3: @@ -491,20 +485,29 @@ void BrowserCommandController::ExecuteCommandWithDisposition( case IDC_METRO_SNAP_DISABLE: browser_->SetMetroSnapMode(false); break; - case IDC_WIN8_DESKTOP_RESTART: - if (!VerifyMetroSwitchForApps(window()->GetNativeWindow(), id)) + case IDC_WIN_DESKTOP_RESTART: + if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id)) break; chrome::AttemptRestartToDesktopMode(); - content::RecordAction(base::UserMetricsAction("Win8DesktopRestart")); + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + content::RecordAction(base::UserMetricsAction("Win8DesktopRestart")); + } else { + content::RecordAction(base::UserMetricsAction("Win7DesktopRestart")); + } break; case IDC_WIN8_METRO_RESTART: - if (!VerifyMetroSwitchForApps(window()->GetNativeWindow(), id)) + case IDC_WIN_CHROMEOS_RESTART: + if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id)) break; - - // SwitchToMetroUIHandler deletes itself. - new SwitchToMetroUIHandler; - content::RecordAction(base::UserMetricsAction("Win8MetroRestart")); + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + // SwitchToMetroUIHandler deletes itself. + new SwitchToMetroUIHandler; + content::RecordAction(base::UserMetricsAction("Win8MetroRestart")); + } else { + content::RecordAction(base::UserMetricsAction("Win7ASHRestart")); + chrome::AttemptRestartToMetroMode(); + } break; #endif @@ -886,11 +889,6 @@ void BrowserCommandController::InitCommandState() { command_updater_.UpdateCommandEnabled(IDC_EXIT, true); #endif command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); -#if defined(OS_WIN) && defined(USE_ASH) && !defined(NDEBUG) - if (base::win::GetVersion() < base::win::VERSION_WIN8 && - chrome::HOST_DESKTOP_TYPE_NATIVE != chrome::HOST_DESKTOP_TYPE_ASH) - command_updater_.UpdateCommandEnabled(IDC_TOGGLE_ASH_DESKTOP, true); -#endif #if defined(USE_ASH) command_updater_.UpdateCommandEnabled(IDC_MINIMIZE_WINDOW, true); #endif @@ -1002,7 +1000,9 @@ void BrowserCommandController::InitCommandState() { bool metro = browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH; command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_ENABLE, metro); command_updater_.UpdateCommandEnabled(IDC_METRO_SNAP_DISABLE, metro); - int restart_mode = metro ? IDC_WIN8_DESKTOP_RESTART : IDC_WIN8_METRO_RESTART; + int restart_mode = metro ? IDC_WIN_DESKTOP_RESTART : + (base::win::GetVersion() >= base::win::VERSION_WIN8 ? + IDC_WIN8_METRO_RESTART : IDC_WIN_CHROMEOS_RESTART); command_updater_.UpdateCommandEnabled(restart_mode, normal_window); #endif diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index 08b2485..0574736 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -545,15 +545,6 @@ void WrenchMenuModel::Build() { if (ShouldShowNewIncognitoWindowMenuItem()) AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); -#if defined(OS_WIN) && !defined(NDEBUG) && defined(USE_ASH) - if (base::win::GetVersion() < base::win::VERSION_WIN8 && - chrome::HOST_DESKTOP_TYPE_NATIVE != chrome::HOST_DESKTOP_TYPE_ASH) { - AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP, - ash::Shell::HasInstance() ? IDS_CLOSE_ASH_DESKTOP : - IDS_OPEN_ASH_DESKTOP); - } -#endif - bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, bookmark_sub_menu_model_.get()); @@ -567,32 +558,23 @@ void WrenchMenuModel::Build() { } #if defined(OS_WIN) - -#if defined(USE_AURA) - if (base::win::GetVersion() >= base::win::VERSION_WIN8 && - content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) { + if (base::win::GetVersion() >= base::win::VERSION_WIN7 && + content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) { if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { - // Metro mode, add the 'Relaunch Chrome in desktop mode'. + // ASH/Metro mode, add the 'Relaunch Chrome in desktop mode'. AddSeparator(ui::NORMAL_SEPARATOR); - AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); + AddItemWithStringId(IDC_WIN_DESKTOP_RESTART, IDS_WIN_DESKTOP_RESTART); } else { // In Windows 8 desktop, add the 'Relaunch Chrome in Windows 8 mode'. + // In Windows 7 desktop, add the 'Relaunch Chrome in Windows ASH mode' AddSeparator(ui::NORMAL_SEPARATOR); - AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); + } else { + AddItemWithStringId(IDC_WIN_CHROMEOS_RESTART, IDS_WIN_CHROMEOS_RESTART); + } } } -#else - if (base::win::IsMetroProcess()) { - // Metro mode, add the 'Relaunch Chrome in desktop mode'. - AddSeparator(ui::NORMAL_SEPARATOR); - AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); - } else { - // In Windows 8 desktop, add the 'Relaunch Chrome in Windows 8 mode'. - AddSeparator(ui::NORMAL_SEPARATOR); - AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); - } -#endif - #endif // Append the full menu including separators. The final separator only gets diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 8eb8aac..12ed44e 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml @@ -11338,14 +11338,36 @@ should be able to be added at any place in this file. <description>Please enter the description of this user action.</description> </action> +<action name="Win7ASHRestart"> + <owner>cpu@chromium.org</owner> + <owner>ananta@chromium.org</owner> + <owner>shrikant@chromium.org</owner> + <description>Tracks when Chrome was restarted on Win7 in Ash.</description> +</action> + +<action name="Win7DesktopRestart"> + <owner>cpu@chromium.org</owner> + <owner>ananta@chromium.org</owner> + <owner>shrikant@chromium.org</owner> + <description> + Tracks when Chrome was restarted on Win7 in desktop. + </description> +</action> + <action name="Win8DesktopRestart"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>cpu@chromium.org</owner> + <owner>ananta@chromium.org</owner> + <owner>shrikant@chromium.org</owner> + <description> + Tracks when Chrome was restarted on Win8 in desktop. + </description> </action> <action name="Win8MetroRestart"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>cpu@chromium.org</owner> + <owner>ananta@chromium.org</owner> + <owner>shrikant@chromium.org</owner> + <description>Tracks when Chrome was restarted on Win8 in metro.</description> </action> <action name="WindowBorder_ClickTogglesSingleAxisMaximize"> diff --git a/win8/delegate_execute/command_execute_impl.h b/win8/delegate_execute/command_execute_impl.h index 0fffd4f..f45bcc9 100644 --- a/win8/delegate_execute/command_execute_impl.h +++ b/win8/delegate_execute/command_execute_impl.h @@ -81,9 +81,10 @@ class ATL_NO_VTABLE DECLSPEC_UUID("071BB5F2-85A4-424F-BFE7-5F1609BE4C2C") // IForegroundTransfer STDMETHOD(AllowForegroundTransfer)(void* reserved); - private: static bool FindChromeExe(base::FilePath* chrome_exe); + private: + static bool path_provider_initialized_; bool GetLaunchScheme(base::string16* display_name, INTERNET_SCHEME* scheme); diff --git a/win8/delegate_execute/delegate_execute.cc b/win8/delegate_execute/delegate_execute.cc index 3bd1ef1..d78210b 100644 --- a/win8/delegate_execute/delegate_execute.cc +++ b/win8/delegate_execute/delegate_execute.cc @@ -17,6 +17,7 @@ #include "base/win/scoped_com_initializer.h" #include "base/win/scoped_comptr.h" #include "base/win/scoped_handle.h" +#include "base/win/windows_version.h" #include "breakpad/src/client/windows/handler/exception_handler.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/util/browser_distribution.h" @@ -117,21 +118,58 @@ int RelaunchChrome(const DelegateExecuteOperation& operation) { AtlTrace("No relaunch mutex found\n"); } - base::win::ScopedCOMInitializer com_initializer; - - base::string16 relaunch_flags(operation.relaunch_flags()); - SHELLEXECUTEINFO sei = { sizeof(sei) }; - sei.fMask = SEE_MASK_FLAG_LOG_USAGE; - sei.nShow = SW_SHOWNORMAL; - sei.lpFile = operation.shortcut().value().c_str(); - sei.lpParameters = relaunch_flags.c_str(); - - AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); - - if (!::ShellExecuteExW(&sei)) { - int error = HRESULT_FROM_WIN32(::GetLastError()); - AtlTrace("ShellExecute returned 0x%08X\n", error); - return error; + // On Windows 8+ to launch Chrome we rely on Windows to use the + // IExecuteCommand interface exposed by delegate_execute to launch Chrome + // into Windows 8 metro mode or desktop. + // On Windows 7 we don't use delegate_execute and instead use plain vanilla + // ShellExecute to launch Chrome into ASH or desktop. + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + base::win::ScopedCOMInitializer com_initializer; + + base::string16 relaunch_flags(operation.relaunch_flags()); + SHELLEXECUTEINFO sei = { sizeof(sei) }; + sei.fMask = SEE_MASK_FLAG_LOG_USAGE; + sei.nShow = SW_SHOWNORMAL; + sei.lpFile = operation.shortcut().value().c_str(); + sei.lpParameters = relaunch_flags.c_str(); + + AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); + + if (!::ShellExecuteExW(&sei)) { + int error = HRESULT_FROM_WIN32(::GetLastError()); + AtlTrace("ShellExecute returned 0x%08X\n", error); + return error; + } + } else { + base::FilePath chrome_exe_path; + bool found_exe = CommandExecuteImpl::FindChromeExe(&chrome_exe_path); + DCHECK(found_exe); + if (found_exe) { + bool launch_ash = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kForceImmersive); + if (launch_ash) { + AtlTrace(L"Relaunching Chrome into Windows ASH on Windows 7\n"); + } else { + AtlTrace(L"Relaunching Chrome into Desktop From ASH on Windows 7\n"); + } + SHELLEXECUTEINFO sei = { sizeof(sei) }; + sei.fMask = SEE_MASK_FLAG_LOG_USAGE; + sei.nShow = SW_SHOWNORMAL; + // No point in using the shortcut if we are launching into ASH as any + // additonal command line switches specified in the shortcut will be + // ignored. This is because we don't have a good way to send the command + // line switches from the viewer to the browser process. + sei.lpFile = (launch_ash || operation.shortcut().empty()) ? + chrome_exe_path.value().c_str() : + operation.shortcut().value().c_str(); + sei.lpParameters = + launch_ash ? L"-ServerName:DefaultBrowserServer" : NULL; + if (!::ShellExecuteExW(&sei)) { + int error = HRESULT_FROM_WIN32(::GetLastError()); + AtlTrace("ShellExecute returned 0x%08X\n", error); + return error; + } + } } return S_OK; } diff --git a/win8/delegate_execute/delegate_execute_operation.cc b/win8/delegate_execute/delegate_execute_operation.cc index 91e5eff..ac36427 100644 --- a/win8/delegate_execute/delegate_execute_operation.cc +++ b/win8/delegate_execute/delegate_execute_operation.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "base/win/windows_version.h" #include "chrome/common/chrome_switches.h" #include "win8/delegate_execute/delegate_execute_util.h" @@ -20,13 +21,19 @@ DelegateExecuteOperation::~DelegateExecuteOperation() { } bool DelegateExecuteOperation::Init(const CommandLine* cmd_line) { - base::FilePath shortcut( - cmd_line->GetSwitchValuePath(switches::kRelaunchShortcut)); - if (shortcut.empty()) { - operation_type_ = DELEGATE_EXECUTE; - return true; + if (base::win::GetVersion() >= base::win::VERSION_WIN7) { + base::FilePath shortcut( + cmd_line->GetSwitchValuePath(switches::kRelaunchShortcut)); + // On Windows 7 the command line coming in may not have a path to the + // shortcut to launch Chrome. We ignore the shortcut and just do a regular + // ShellExecute of chrome.exe in this case. + if (shortcut.empty() && + base::win::GetVersion() >= base::win::VERSION_WIN8) { + operation_type_ = DELEGATE_EXECUTE; + return true; + } + relaunch_shortcut_ = shortcut; } - relaunch_shortcut_ = shortcut; mutex_ = cmd_line->GetSwitchValueNative(switches::kWaitForMutex); if (mutex_.empty()) return false; |