| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // Implementation of the CommandExecuteImpl class which implements the | 4 // Implementation of the CommandExecuteImpl class which implements the |
| 5 // IExecuteCommand and related interfaces for handling ShellExecute based | 5 // IExecuteCommand and related interfaces for handling ShellExecute based |
| 6 // launches of the Chrome browser. | 6 // launches of the Chrome browser. |
| 7 | 7 |
| 8 #include "win8/delegate_execute/command_execute_impl.h" | 8 #include "win8/delegate_execute/command_execute_impl.h" |
| 9 | 9 |
| 10 #include <shlguid.h> | 10 #include <shlguid.h> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (hr != S_OK) { | 52 if (hr != S_OK) { |
| 53 AtlTrace("Failed to get display name\n"); | 53 AtlTrace("Failed to get display name\n"); |
| 54 return hr; | 54 return hr; |
| 55 } | 55 } |
| 56 | 56 |
| 57 *url = static_cast<const wchar_t*>(name); | 57 *url = static_cast<const wchar_t*>(name); |
| 58 AtlTrace("Retrieved url from display name %ls\n", url->c_str()); | 58 AtlTrace("Retrieved url from display name %ls\n", url->c_str()); |
| 59 return S_OK; | 59 return S_OK; |
| 60 } | 60 } |
| 61 | 61 |
| 62 #if defined(USE_AURA) |
| 62 bool LaunchChromeBrowserProcess() { | 63 bool LaunchChromeBrowserProcess() { |
| 63 base::FilePath delegate_exe_path; | 64 base::FilePath delegate_exe_path; |
| 64 if (!PathService::Get(base::FILE_EXE, &delegate_exe_path)) | 65 if (!PathService::Get(base::FILE_EXE, &delegate_exe_path)) |
| 65 return false; | 66 return false; |
| 66 | 67 |
| 67 // First try and go up a level to find chrome.exe. | 68 // First try and go up a level to find chrome.exe. |
| 68 base::FilePath chrome_exe_path = | 69 base::FilePath chrome_exe_path = |
| 69 delegate_exe_path.DirName() | 70 delegate_exe_path.DirName() |
| 70 .DirName() | 71 .DirName() |
| 71 .Append(chrome::kBrowserProcessExecutableName); | 72 .Append(chrome::kBrowserProcessExecutableName); |
| 72 if (!file_util::PathExists(chrome_exe_path)) { | 73 if (!file_util::PathExists(chrome_exe_path)) { |
| 73 // Try looking in the current directory if we couldn't find it one up in | 74 // Try looking in the current directory if we couldn't find it one up in |
| 74 // order to support developer installs. | 75 // order to support developer installs. |
| 75 chrome_exe_path = | 76 chrome_exe_path = |
| 76 delegate_exe_path.DirName() | 77 delegate_exe_path.DirName() |
| 77 .Append(chrome::kBrowserProcessExecutableName); | 78 .Append(chrome::kBrowserProcessExecutableName); |
| 78 } | 79 } |
| 79 | 80 |
| 80 if (!file_util::PathExists(chrome_exe_path)) { | 81 if (!file_util::PathExists(chrome_exe_path)) { |
| 81 AtlTrace("Could not locate chrome.exe at: %ls\n", | 82 AtlTrace("Could not locate chrome.exe at: %ls\n", |
| 82 chrome_exe_path.value().c_str()); | 83 chrome_exe_path.value().c_str()); |
| 83 return false; | 84 return false; |
| 84 } | 85 } |
| 85 | 86 |
| 86 CommandLine cl(chrome_exe_path); | 87 CommandLine cl(chrome_exe_path); |
| 87 | 88 |
| 88 // Prevent a Chrome window from showing up on the desktop. | 89 // Prevent a Chrome window from showing up on the desktop. |
| 89 cl.AppendSwitch(switches::kSilentLaunch); | 90 cl.AppendSwitch(switches::kSilentLaunch); |
| 90 | 91 |
| 91 // Tell Chrome the IPC channel name to use. | 92 // Tell Chrome to connect to the Metro viewer process. |
| 92 // TODO(robertshield): Figure out how to get this name to both the launched | 93 cl.AppendSwitch(switches::kViewerConnect); |
| 93 // desktop browser process and the resulting activated metro process. | |
| 94 cl.AppendSwitchASCII(switches::kViewerConnection, "viewer"); | |
| 95 | 94 |
| 96 base::LaunchOptions launch_options; | 95 base::LaunchOptions launch_options; |
| 97 launch_options.start_hidden = true; | 96 launch_options.start_hidden = true; |
| 98 | 97 |
| 99 return base::LaunchProcess(cl, launch_options, NULL); | 98 return base::LaunchProcess(cl, launch_options, NULL); |
| 100 } | 99 } |
| 100 #endif // defined(USE_AURA) |
| 101 | 101 |
| 102 } // namespace | 102 } // namespace |
| 103 | 103 |
| 104 bool CommandExecuteImpl::path_provider_initialized_ = false; | 104 bool CommandExecuteImpl::path_provider_initialized_ = false; |
| 105 | 105 |
| 106 // CommandExecuteImpl is resposible for activating chrome in Windows 8. The | 106 // CommandExecuteImpl is resposible for activating chrome in Windows 8. The |
| 107 // flow is complicated and this tries to highlight the important events. | 107 // flow is complicated and this tries to highlight the important events. |
| 108 // The current approach is to have a single instance of chrome either | 108 // The current approach is to have a single instance of chrome either |
| 109 // running in desktop or metro mode. If there is no current instance then | 109 // running in desktop or metro mode. If there is no current instance then |
| 110 // the desktop shortcut launches desktop chrome and the metro tile or search | 110 // the desktop shortcut launches desktop chrome and the metro tile or search |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
| 577 launch_mode = ECHUIM_DESKTOP; | 577 launch_mode = ECHUIM_DESKTOP; |
| 578 } else { | 578 } else { |
| 579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
| 580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
| 581 } | 581 } |
| 582 | 582 |
| 583 launch_mode_determined = true; | 583 launch_mode_determined = true; |
| 584 return launch_mode; | 584 return launch_mode; |
| 585 } | 585 } |
| OLD | NEW |