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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 STDMETHODIMP CommandExecuteImpl::SetNoShowUI(BOOL no_show_ui) { | 203 STDMETHODIMP CommandExecuteImpl::SetNoShowUI(BOOL no_show_ui) { |
204 return S_OK; | 204 return S_OK; |
205 } | 205 } |
206 | 206 |
207 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { | 207 STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { |
208 return S_OK; | 208 return S_OK; |
209 } | 209 } |
210 | 210 |
211 void CommandExecuteImpl::SetHighDPIRegistryKey(bool enable) { | |
212 uint32 key_value = enable ? 1 : 2; | |
213 base::win::RegKey high_dpi_key(HKEY_CURRENT_USER); | |
214 high_dpi_key.CreateKey(gfx::win::kRegistryProfilePath, KEY_SET_VALUE); | |
215 high_dpi_key.WriteValue(gfx::win::kHighDPISupportW, key_value); | |
216 } | |
217 | |
218 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { | 211 STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { |
219 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { | 212 if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { |
220 AtlTrace("Failed to get scheme, E_FAIL\n"); | 213 AtlTrace("Failed to get scheme, E_FAIL\n"); |
221 return E_FAIL; | 214 return E_FAIL; |
222 } | 215 } |
223 | 216 |
224 EC_HOST_UI_MODE mode = GetLaunchMode(); | 217 EC_HOST_UI_MODE mode = GetLaunchMode(); |
225 *pahe = (mode == ECHUIM_DESKTOP) ? AHE_DESKTOP : AHE_IMMERSIVE; | 218 *pahe = (mode == ECHUIM_DESKTOP) ? AHE_DESKTOP : AHE_IMMERSIVE; |
226 | 219 |
227 // If we're going to return AHE_IMMERSIVE, then both the browser process and | 220 // If we're going to return AHE_IMMERSIVE, then both the browser process and |
228 // the metro viewer need to launch and connect before the user can start | 221 // the metro viewer need to launch and connect before the user can start |
229 // browsing. However we must not launch the metro viewer until we get a | 222 // browsing. However we must not launch the metro viewer until we get a |
230 // call to CommandExecuteImpl::Execute(). If we wait until then to launch | 223 // call to CommandExecuteImpl::Execute(). If we wait until then to launch |
231 // the browser process as well, it will appear laggy while they connect to | 224 // the browser process as well, it will appear laggy while they connect to |
232 // each other, so we pre-launch the browser process now. | 225 // each other, so we pre-launch the browser process now. |
233 if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb) { | 226 if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb) { |
234 SetHighDPIRegistryKey(true); | |
235 LaunchChromeBrowserProcess(); | 227 LaunchChromeBrowserProcess(); |
236 } | 228 } |
237 return S_OK; | 229 return S_OK; |
238 } | 230 } |
239 | 231 |
240 STDMETHODIMP CommandExecuteImpl::Execute() { | 232 STDMETHODIMP CommandExecuteImpl::Execute() { |
241 AtlTrace("In %hs\n", __FUNCTION__); | 233 AtlTrace("In %hs\n", __FUNCTION__); |
242 | 234 |
243 if (integrity_level_ == base::HIGH_INTEGRITY) | 235 if (integrity_level_ == base::HIGH_INTEGRITY) |
244 return LaunchDesktopChrome(); | 236 return LaunchDesktopChrome(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // chrome is the default we should treat it as a parameter to be passed | 383 // chrome is the default we should treat it as a parameter to be passed |
392 // to chrome. | 384 // to chrome. |
393 if (display_name.find(installer::kChromeExe) != base::string16::npos) | 385 if (display_name.find(installer::kChromeExe) != base::string16::npos) |
394 display_name.clear(); | 386 display_name.clear(); |
395 break; | 387 break; |
396 | 388 |
397 default: | 389 default: |
398 break; | 390 break; |
399 } | 391 } |
400 | 392 |
401 SetHighDPIRegistryKey(false); | |
402 | |
403 CommandLine chrome( | 393 CommandLine chrome( |
404 delegate_execute::MakeChromeCommandLine(chrome_exe_, parameters_, | 394 delegate_execute::MakeChromeCommandLine(chrome_exe_, parameters_, |
405 display_name)); | 395 display_name)); |
406 base::string16 command_line(chrome.GetCommandLineString()); | 396 base::string16 command_line(chrome.GetCommandLineString()); |
407 | 397 |
408 AtlTrace("Formatted command line is %ls\n", command_line.c_str()); | 398 AtlTrace("Formatted command line is %ls\n", command_line.c_str()); |
409 | 399 |
410 PROCESS_INFORMATION temp_process_info = {}; | 400 PROCESS_INFORMATION temp_process_info = {}; |
411 BOOL ret = CreateProcess(chrome_exe_.value().c_str(), | 401 BOOL ret = CreateProcess(chrome_exe_.value().c_str(), |
412 const_cast<LPWSTR>(command_line.c_str()), | 402 const_cast<LPWSTR>(command_line.c_str()), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 494 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
505 launch_mode = ECHUIM_DESKTOP; | 495 launch_mode = ECHUIM_DESKTOP; |
506 } else { | 496 } else { |
507 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 497 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
508 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 498 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
509 } | 499 } |
510 | 500 |
511 launch_mode_determined = true; | 501 launch_mode_determined = true; |
512 return launch_mode; | 502 return launch_mode; |
513 } | 503 } |
OLD | NEW |