| Index: win8/delegate_execute/command_execute_impl.cc
|
| diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
|
| index 0d05dc517ee251e2d2eb8eb5cd3aed2d98847394..325d7d4bf84cb83a5502d5e69885f872502e5f7c 100644
|
| --- a/win8/delegate_execute/command_execute_impl.cc
|
| +++ b/win8/delegate_execute/command_execute_impl.cc
|
| @@ -133,11 +133,12 @@ bool CommandExecuteImpl::path_provider_initialized_ = false;
|
| // the launch scheme (or url) and the activation verb.
|
| // 5- Windows calls CommandExecuteImpl::Getvalue()
|
| // Here we need to return AHE_IMMERSIVE or AHE_DESKTOP. That depends on:
|
| -// a) if run in high-integrity return AHE_DESKTOP
|
| +// a) if run in high-integrity return AHE_DESKTOP.
|
| // b) else we return what GetLaunchMode() tells us, which is:
|
| -// i) if the command line --force-xxx is present return that
|
| -// ii) if the registry 'launch_mode' exists return that
|
| -// iii) else return AHE_DESKTOP
|
| +// i) if chrome is not the default browser, return AHE_DESKTOP
|
| +// ii) if the command line --force-xxx is present return that
|
| +// iii) if the registry 'launch_mode' exists return that
|
| +// iv) else return AHE_DESKTOP
|
| // 6- If we returned AHE_IMMERSIVE in step 5 windows might not call us back
|
| // and simply activate chrome in metro by itself, however in some cases
|
| // it might proceed at step 7.
|
| @@ -209,6 +210,12 @@ STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) {
|
| EC_HOST_UI_MODE mode = GetLaunchMode();
|
| *pahe = (mode == ECHUIM_DESKTOP) ? AHE_DESKTOP : AHE_IMMERSIVE;
|
|
|
| + // If we're going to return AHE_IMMERSIVE, then both the browser process and
|
| + // the metro viewer need to launch and connect before the user can start
|
| + // browsing. However we must not launch the metro viewer until we get a
|
| + // call to CommandExecuteImpl::Execute(). If we wait until then to launch
|
| + // the browser process as well, it will appear laggy while they connect to
|
| + // each other, so we pre-launch the browser process now.
|
| if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb)
|
| LaunchChromeBrowserProcess();
|
| return S_OK;
|
| @@ -415,6 +422,17 @@ EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() {
|
| launch_mode_determined = true;
|
| return launch_mode;
|
| }
|
| +
|
| + base::FilePath chrome_exe;
|
| + if (!FindChromeExe(&chrome_exe) ||
|
| + ShellUtil::GetChromeDefaultStateFromPath(chrome_exe) !=
|
| + ShellUtil::DefaultState::IS_DEFAULT) {
|
| + AtlTrace("Chrome is not default: launching in desktop mode\n");
|
| + launch_mode = ECHUIM_DESKTOP;
|
| + launch_mode_determined = true;
|
| + return launch_mode;
|
| + }
|
| +
|
| if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_F11)) {
|
| AtlTrace("Hotkey: launching in immersive mode\n");
|
| launch_mode = ECHUIM_IMMERSIVE;
|
|
|