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> |
11 | 11 |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/win/metro.h" | |
18 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
19 #include "base/win/scoped_co_mem.h" | 18 #include "base/win/scoped_co_mem.h" |
20 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
21 #include "base/win/scoped_process_information.h" | 20 #include "base/win/scoped_process_information.h" |
22 #include "base/win/win_util.h" | 21 #include "base/win/win_util.h" |
23 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
24 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/installer/util/browser_distribution.h" | 26 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_F11)) { | 446 if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_F11)) { |
448 AtlTrace("Hotkey: launching in immersive mode\n"); | 447 AtlTrace("Hotkey: launching in immersive mode\n"); |
449 launch_mode = ECHUIM_IMMERSIVE; | 448 launch_mode = ECHUIM_IMMERSIVE; |
450 launch_mode_determined = true; | 449 launch_mode_determined = true; |
451 return launch_mode; | 450 return launch_mode; |
452 } | 451 } |
453 | 452 |
454 // From here on, if we can, we will write the outcome | 453 // From here on, if we can, we will write the outcome |
455 // of this function to the registry. | 454 // of this function to the registry. |
456 if (parameters_.HasSwitch(switches::kForceImmersive)) { | 455 if (parameters_.HasSwitch(switches::kForceImmersive)) { |
457 launch_mode = ECHUIM_IMMERSIVE; | 456 launch_mode = ECHUIM_IMMERSIVE; |
gab
2016/01/14 03:30:37
We should probably get rid of all ECHUIM_IMMERSIVE
| |
458 launch_mode_determined = true; | 457 launch_mode_determined = true; |
459 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM); | 458 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM); |
460 } else if (parameters_.HasSwitch(switches::kForceDesktop)) { | 459 } else if (parameters_.HasSwitch(switches::kForceDesktop)) { |
461 launch_mode = ECHUIM_DESKTOP; | 460 launch_mode = ECHUIM_DESKTOP; |
462 launch_mode_determined = true; | 461 launch_mode_determined = true; |
463 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM); | 462 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM); |
464 } | 463 } |
465 | 464 |
466 base::win::RegKey reg_key; | 465 base::win::RegKey reg_key; |
467 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, | 466 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, |
(...skipping 12 matching lines...) Expand all Loading... | |
480 return launch_mode; | 479 return launch_mode; |
481 } | 480 } |
482 | 481 |
483 if (launch_mode_determined) { | 482 if (launch_mode_determined) { |
484 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]); |
485 reg_key.WriteValue(chrome::kLaunchModeValue, | 484 reg_key.WriteValue(chrome::kLaunchModeValue, |
486 static_cast<DWORD>(launch_mode)); | 485 static_cast<DWORD>(launch_mode)); |
487 return launch_mode; | 486 return launch_mode; |
488 } | 487 } |
489 | 488 |
490 if (!base::win::IsChromeMetroSupported()) { | 489 launch_mode = ECHUIM_DESKTOP; |
491 launch_mode = ECHUIM_DESKTOP; | |
492 launch_mode_determined = true; | |
493 return launch_mode; | |
494 } | |
495 | |
496 // Use the previous mode if available. Else launch in desktop mode. | |
497 DWORD reg_value; | |
498 if (reg_key.ReadValueDW(chrome::kLaunchModeValue, | |
gab
2016/01/12 21:11:04
Please add cleanup code to delete this value inste
scottmg
2016/01/13 20:48:16
Do we normally do this? How long should we keep th
gab
2016/01/14 03:10:27
Yes. We do this all over the installer and in chro
gab
2016/01/14 03:12:24
Err... >= 4.5 months (18 weeks) on Stable
| |
499 ®_value) != ERROR_SUCCESS) { | |
500 launch_mode = ECHUIM_DESKTOP; | |
501 AtlTrace("Can't read registry, defaulting to %s\n", modes[launch_mode]); | |
502 } else if (reg_value >= ECHUIM_SYSTEM_LAUNCHER) { | |
503 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | |
504 launch_mode = ECHUIM_DESKTOP; | |
505 } else { | |
506 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | |
507 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | |
508 } | |
509 | |
510 launch_mode_determined = true; | 490 launch_mode_determined = true; |
511 return launch_mode; | 491 return launch_mode; |
512 } | 492 } |
OLD | NEW |