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 14 matching lines...) Expand all Loading... |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/installer/util/browser_distribution.h" | 26 #include "chrome/installer/util/browser_distribution.h" |
27 #include "chrome/installer/util/install_util.h" | 27 #include "chrome/installer/util/install_util.h" |
28 #include "chrome/installer/util/shell_util.h" | 28 #include "chrome/installer/util/shell_util.h" |
29 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
30 #include "ui/base/clipboard/clipboard_util_win.h" | 30 #include "ui/base/clipboard/clipboard_util_win.h" |
31 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
32 #include "ui/gfx/win/dpi.h" | 32 #include "ui/gfx/win/dpi.h" |
33 #include "win8/delegate_execute/chrome_util.h" | 33 #include "win8/delegate_execute/chrome_util.h" |
34 #include "win8/delegate_execute/delegate_execute_util.h" | 34 #include "win8/delegate_execute/delegate_execute_util.h" |
| 35 #include "win8/viewer/metro_viewer_constants.h" |
35 | 36 |
36 namespace { | 37 namespace { |
37 // Helper function to retrieve the url from IShellItem interface passed in. | 38 // Helper function to retrieve the url from IShellItem interface passed in. |
38 // Returns S_OK on success. | 39 // Returns S_OK on success. |
39 HRESULT GetUrlFromShellItem(IShellItem* shell_item, base::string16* url) { | 40 HRESULT GetUrlFromShellItem(IShellItem* shell_item, base::string16* url) { |
40 DCHECK(shell_item); | 41 DCHECK(shell_item); |
41 DCHECK(url); | 42 DCHECK(url); |
42 // First attempt to get the url from the underlying IDataObject if any. This | 43 // First attempt to get the url from the underlying IDataObject if any. This |
43 // ensures that we get the full url, i.e. including the anchor. | 44 // ensures that we get the full url, i.e. including the anchor. |
44 // If we fail to get the underlying IDataObject we retrieve the url via the | 45 // If we fail to get the underlying IDataObject we retrieve the url via the |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { | 212 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { |
212 return S_OK; | 213 return S_OK; |
213 } | 214 } |
214 | 215 |
215 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { | 216 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { |
216 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { | 217 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { |
217 AtlTrace("Failed to get scheme, E_FAIL\n"); | 218 AtlTrace("Failed to get scheme, E_FAIL\n"); |
218 return E_FAIL; | 219 return E_FAIL; |
219 } | 220 } |
220 | 221 |
221 // TODO(scottmg): Can all go eventually https://crbug.com/558054. | 222 EC_HOST_UI_MODE mode = GetLaunchMode(); |
222 *pahe = AHE_DESKTOP; | 223 *pahe = (mode == ECHUIM_DESKTOP) ? AHE_DESKTOP : AHE_IMMERSIVE; |
| 224 |
| 225 // If we're going to return AHE_IMMERSIVE, then both the browser process and |
| 226 // the metro viewer need to launch and connect before the user can start |
| 227 // browsing. However we must not launch the metro viewer until we get a |
| 228 // call to CommandExecuteImpl::Execute(). If we wait until then to launch |
| 229 // the browser process as well, it will appear laggy while they connect to |
| 230 // each other, so we pre-launch the browser process now. |
| 231 if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb) { |
| 232 LaunchChromeBrowserProcess(); |
| 233 } |
223 return S_OK; | 234 return S_OK; |
224 } | 235 } |
225 | 236 |
226 STDMETHODIMP CommandExecuteImpl::Execute() { | 237 STDMETHODIMP CommandExecuteImpl::Execute() { |
227 AtlTrace("In %hs\n", __FUNCTION__); | 238 AtlTrace("In %hs\n", __FUNCTION__); |
228 | 239 |
229 if (integrity_level_ == base::HIGH_INTEGRITY) | 240 if (integrity_level_ == base::HIGH_INTEGRITY) |
230 return LaunchDesktopChrome(); | 241 return LaunchDesktopChrome(); |
231 | 242 |
232 EC_HOST_UI_MODE mode = GetLaunchMode(); | 243 EC_HOST_UI_MODE mode = GetLaunchMode(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); | 483 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); |
473 reg_key.WriteValue(chrome::kLaunchModeValue, | 484 reg_key.WriteValue(chrome::kLaunchModeValue, |
474 static_cast<DWORD>(launch_mode)); | 485 static_cast<DWORD>(launch_mode)); |
475 return launch_mode; | 486 return launch_mode; |
476 } | 487 } |
477 | 488 |
478 launch_mode = ECHUIM_DESKTOP; | 489 launch_mode = ECHUIM_DESKTOP; |
479 launch_mode_determined = true; | 490 launch_mode_determined = true; |
480 return launch_mode; | 491 return launch_mode; |
481 } | 492 } |
OLD | NEW |