OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include <tchar.h> | 6 #include <tchar.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "chrome/app/client_util.h" | 14 #include "chrome/app/client_util.h" |
15 #include "chrome/browser/chrome_process_finder_win.h" | 15 #include "chrome/browser/chrome_process_finder_win.h" |
16 #include "chrome/browser/policy/policy_path_parser.h" | 16 #include "chrome/browser/policy/policy_path_parser.h" |
17 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
18 #include "chrome/common/chrome_paths_internal.h" | 18 #include "chrome/common/chrome_paths_internal.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome_elf/chrome_elf_main.h" | 20 #include "chrome_elf/chrome_elf_main.h" |
21 #include "components/startup_metric_utils/startup_metric_utils.h" | 21 #include "components/startup_metric_utils/startup_metric_utils.h" |
22 #include "content/public/common/result_codes.h" | 22 #include "content/public/common/result_codes.h" |
23 #include "ui/gfx/win/dpi.h" | 23 #include "ui/gfx/dpi.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 void CheckSafeModeLaunch() { | 27 void CheckSafeModeLaunch() { |
28 unsigned short k1 = ::GetAsyncKeyState(VK_CONTROL); | 28 unsigned short k1 = ::GetAsyncKeyState(VK_CONTROL); |
29 unsigned short k2 = ::GetAsyncKeyState(VK_MENU); | 29 unsigned short k2 = ::GetAsyncKeyState(VK_MENU); |
30 const unsigned short kPressedMask = 0x8000; | 30 const unsigned short kPressedMask = 0x8000; |
31 if ((k1 & kPressedMask) && (k2 & kPressedMask)) | 31 if ((k1 & kPressedMask) && (k2 & kPressedMask)) |
32 ::SetEnvironmentVariableA(chrome::kSafeModeEnvVar, "1"); | 32 ::SetEnvironmentVariableA(chrome::kSafeModeEnvVar, "1"); |
33 } | 33 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // Initialize the commandline singleton from the environment. | 96 // Initialize the commandline singleton from the environment. |
97 CommandLine::Init(0, NULL); | 97 CommandLine::Init(0, NULL); |
98 // The exit manager is in charge of calling the dtors of singletons. | 98 // The exit manager is in charge of calling the dtors of singletons. |
99 base::AtExitManager exit_manager; | 99 base::AtExitManager exit_manager; |
100 | 100 |
101 // We don't want to set DPI awareness on Vista because we don't support | 101 // We don't want to set DPI awareness on Vista because we don't support |
102 // DirectWrite there. GDI fonts are kerned very badly, so better to leave | 102 // DirectWrite there. GDI fonts are kerned very badly, so better to leave |
103 // DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite(). | 103 // DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite(). |
104 if (base::win::GetVersion() > base::win::VERSION_VISTA) | 104 if (base::win::GetVersion() > base::win::VERSION_VISTA) |
105 gfx::EnableHighDPISupport(); | 105 gfx::win::EnableHighDPISupport(); |
106 | 106 |
107 if (AttemptFastNotify(*CommandLine::ForCurrentProcess())) | 107 if (AttemptFastNotify(*CommandLine::ForCurrentProcess())) |
108 return 0; | 108 return 0; |
109 | 109 |
110 CheckSafeModeLaunch(); | 110 CheckSafeModeLaunch(); |
111 | 111 |
112 // Load and launch the chrome dll. *Everything* happens inside. | 112 // Load and launch the chrome dll. *Everything* happens inside. |
113 MainDllLoader* loader = MakeMainDllLoader(); | 113 MainDllLoader* loader = MakeMainDllLoader(); |
114 int rc = loader->Launch(instance); | 114 int rc = loader->Launch(instance); |
115 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 115 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
116 delete loader; | 116 delete loader; |
117 return rc; | 117 return rc; |
118 } | 118 } |
OLD | NEW |