| 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" | |
| 36 | 35 |
| 37 namespace { | 36 namespace { |
| 38 // Helper function to retrieve the url from IShellItem interface passed in. | 37 // Helper function to retrieve the url from IShellItem interface passed in. |
| 39 // Returns S_OK on success. | 38 // Returns S_OK on success. |
| 40 HRESULT GetUrlFromShellItem(IShellItem* shell_item, base::string16* url) { | 39 HRESULT GetUrlFromShellItem(IShellItem* shell_item, base::string16* url) { |
| 41 DCHECK(shell_item); | 40 DCHECK(shell_item); |
| 42 DCHECK(url); | 41 DCHECK(url); |
| 43 // First attempt to get the url from the underlying IDataObject if any. This | 42 // First attempt to get the url from the underlying IDataObject if any. This |
| 44 // ensures that we get the full url, i.e. including the anchor. | 43 // ensures that we get the full url, i.e. including the anchor. |
| 45 // If we fail to get the underlying IDataObject we retrieve the url via the | 44 // 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... |
| 212 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { | 211 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { |
| 213 return S_OK; | 212 return S_OK; |
| 214 } | 213 } |
| 215 | 214 |
| 216 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { | 215 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { |
| 217 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { | 216 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { |
| 218 AtlTrace("Failed to get scheme, E_FAIL\n"); | 217 AtlTrace("Failed to get scheme, E_FAIL\n"); |
| 219 return E_FAIL; | 218 return E_FAIL; |
| 220 } | 219 } |
| 221 | 220 |
| 222 EC_HOST_UI_MODE mode = GetLaunchMode(); | 221 // TODO(scottmg): Can all go eventually https://crbug.com/558054. |
| 223 *pahe = (mode == ECHUIM_DESKTOP) ? AHE_DESKTOP : AHE_IMMERSIVE; | 222 *pahe = AHE_DESKTOP; |
| 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 } | |
| 234 return S_OK; | 223 return S_OK; |
| 235 } | 224 } |
| 236 | 225 |
| 237 STDMETHODIMP CommandExecuteImpl::Execute() { | 226 STDMETHODIMP CommandExecuteImpl::Execute() { |
| 238 AtlTrace("In %hs\n", __FUNCTION__); | 227 AtlTrace("In %hs\n", __FUNCTION__); |
| 239 | 228 |
| 240 if (integrity_level_ == base::HIGH_INTEGRITY) | 229 if (integrity_level_ == base::HIGH_INTEGRITY) |
| 241 return LaunchDesktopChrome(); | 230 return LaunchDesktopChrome(); |
| 242 | 231 |
| 243 EC_HOST_UI_MODE mode = GetLaunchMode(); | 232 EC_HOST_UI_MODE mode = GetLaunchMode(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); | 472 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); |
| 484 reg_key.WriteValue(chrome::kLaunchModeValue, | 473 reg_key.WriteValue(chrome::kLaunchModeValue, |
| 485 static_cast<DWORD>(launch_mode)); | 474 static_cast<DWORD>(launch_mode)); |
| 486 return launch_mode; | 475 return launch_mode; |
| 487 } | 476 } |
| 488 | 477 |
| 489 launch_mode = ECHUIM_DESKTOP; | 478 launch_mode = ECHUIM_DESKTOP; |
| 490 launch_mode_determined = true; | 479 launch_mode_determined = true; |
| 491 return launch_mode; | 480 return launch_mode; |
| 492 } | 481 } |
| OLD | NEW |