| 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/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/process/launch.h" | 14 #include "base/process/launch.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/win/message_window.h" | 16 #include "base/win/message_window.h" |
| 17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
| 18 #include "base/win/scoped_co_mem.h" | 18 #include "base/win/scoped_co_mem.h" |
| 19 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 20 #include "base/win/scoped_process_information.h" | 20 #include "base/win/scoped_process_information.h" |
| 21 #include "base/win/win_util.h" | 21 #include "base/win/win_util.h" |
| 22 #include "base/win/windows_version.h" |
| 22 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/installer/util/browser_distribution.h" | 26 #include "chrome/installer/util/browser_distribution.h" |
| 26 #include "chrome/installer/util/install_util.h" | 27 #include "chrome/installer/util/install_util.h" |
| 27 #include "chrome/installer/util/shell_util.h" | 28 #include "chrome/installer/util/shell_util.h" |
| 28 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
| 29 #include "ui/base/clipboard/clipboard_util_win.h" | 30 #include "ui/base/clipboard/clipboard_util_win.h" |
| 30 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
| 31 #include "ui/gfx/win/dpi.h" | 32 #include "ui/gfx/win/dpi.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 return launch_mode; | 476 return launch_mode; |
| 476 } | 477 } |
| 477 | 478 |
| 478 if (launch_mode_determined) { | 479 if (launch_mode_determined) { |
| 479 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); | 480 AtlTrace("Launch mode forced by cmdline to %s\n", modes[launch_mode]); |
| 480 reg_key.WriteValue(chrome::kLaunchModeValue, | 481 reg_key.WriteValue(chrome::kLaunchModeValue, |
| 481 static_cast<DWORD>(launch_mode)); | 482 static_cast<DWORD>(launch_mode)); |
| 482 return launch_mode; | 483 return launch_mode; |
| 483 } | 484 } |
| 484 | 485 |
| 486 // As of now ActivateApplication fails on Windows 10 (Build 9926). |
| 487 // Until there is some clarity on special status of browser in metro mode on |
| 488 // Windows 10, we just disable Chrome metro mode so that browser remains |
| 489 // usable. |
| 490 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
| 491 launch_mode = ECHUIM_DESKTOP; |
| 492 launch_mode_determined = true; |
| 493 return launch_mode; |
| 494 } |
| 495 |
| 485 // Use the previous mode if available. Else launch in desktop mode. | 496 // Use the previous mode if available. Else launch in desktop mode. |
| 486 DWORD reg_value; | 497 DWORD reg_value; |
| 487 if (reg_key.ReadValueDW(chrome::kLaunchModeValue, | 498 if (reg_key.ReadValueDW(chrome::kLaunchModeValue, |
| 488 ®_value) != ERROR_SUCCESS) { | 499 ®_value) != ERROR_SUCCESS) { |
| 489 launch_mode = ECHUIM_DESKTOP; | 500 launch_mode = ECHUIM_DESKTOP; |
| 490 AtlTrace("Can't read registry, defaulting to %s\n", modes[launch_mode]); | 501 AtlTrace("Can't read registry, defaulting to %s\n", modes[launch_mode]); |
| 491 } else if (reg_value >= ECHUIM_SYSTEM_LAUNCHER) { | 502 } else if (reg_value >= ECHUIM_SYSTEM_LAUNCHER) { |
| 492 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 503 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
| 493 launch_mode = ECHUIM_DESKTOP; | 504 launch_mode = ECHUIM_DESKTOP; |
| 494 } else { | 505 } else { |
| 495 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 506 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
| 496 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 507 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
| 497 } | 508 } |
| 498 | 509 |
| 499 launch_mode_determined = true; | 510 launch_mode_determined = true; |
| 500 return launch_mode; | 511 return launch_mode; |
| 501 } | 512 } |
| OLD | NEW |