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 <malloc.h> | 6 #include <malloc.h> |
7 #include <shellscalingapi.h> | 7 #include <shellscalingapi.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/app/chrome_crash_reporter_client_win.h" | 26 #include "chrome/app/chrome_crash_reporter_client_win.h" |
27 #include "chrome/app/main_dll_loader_win.h" | 27 #include "chrome/app/main_dll_loader_win.h" |
28 #include "chrome/browser/chrome_process_finder_win.h" | |
29 #include "chrome/browser/policy/policy_path_parser.h" | 28 #include "chrome/browser/policy/policy_path_parser.h" |
| 29 #include "chrome/browser/win/chrome_process_finder.h" |
30 #include "chrome/common/chrome_paths_internal.h" | 30 #include "chrome/common/chrome_paths_internal.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
33 #include "chrome_elf/chrome_elf_main.h" | 33 #include "chrome_elf/chrome_elf_main.h" |
34 #include "components/crash/content/app/crash_reporter_client.h" | 34 #include "components/crash/content/app/crash_reporter_client.h" |
35 #include "components/crash/content/app/crash_switches.h" | 35 #include "components/crash/content/app/crash_switches.h" |
36 #include "components/crash/content/app/crashpad.h" | 36 #include "components/crash/content/app/crashpad.h" |
37 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 37 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
38 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 38 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
39 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | 39 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 bool AttemptFastNotify(const base::CommandLine& command_line) { | 81 bool AttemptFastNotify(const base::CommandLine& command_line) { |
82 if (ContainsNonFastStartFlag(command_line)) | 82 if (ContainsNonFastStartFlag(command_line)) |
83 return false; | 83 return false; |
84 | 84 |
85 base::FilePath user_data_dir; | 85 base::FilePath user_data_dir; |
86 if (!chrome::GetDefaultUserDataDirectory(&user_data_dir)) | 86 if (!chrome::GetDefaultUserDataDirectory(&user_data_dir)) |
87 return false; | 87 return false; |
88 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | 88 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
89 | 89 |
90 HWND chrome = chrome::FindRunningChromeWindow(user_data_dir); | 90 HWND chrome = chrome::win::FindRunningChromeWindow(user_data_dir); |
91 if (!chrome) | 91 if (!chrome) |
92 return false; | 92 return false; |
93 return chrome::AttemptToNotifyRunningChrome(chrome, true) == | 93 return chrome::win::AttemptToNotifyRunningChrome(chrome, true) == |
94 chrome::NOTIFY_SUCCESS; | 94 chrome::win::NOTIFY_SUCCESS; |
95 } | 95 } |
96 | 96 |
97 // Win8.1 supports monitor-specific DPI scaling. | 97 // Win8.1 supports monitor-specific DPI scaling. |
98 bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) { | 98 bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) { |
99 typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS); | 99 typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS); |
100 SetProcessDpiAwarenessPtr set_process_dpi_awareness_func = | 100 SetProcessDpiAwarenessPtr set_process_dpi_awareness_func = |
101 reinterpret_cast<SetProcessDpiAwarenessPtr>( | 101 reinterpret_cast<SetProcessDpiAwarenessPtr>( |
102 GetProcAddress(GetModuleHandleA("user32.dll"), | 102 GetProcAddress(GetModuleHandleA("user32.dll"), |
103 "SetProcessDpiAwarenessInternal")); | 103 "SetProcessDpiAwarenessInternal")); |
104 if (set_process_dpi_awareness_func) { | 104 if (set_process_dpi_awareness_func) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 RemoveAppCompatFlagsEntry(); | 257 RemoveAppCompatFlagsEntry(); |
258 | 258 |
259 // Load and launch the chrome dll. *Everything* happens inside. | 259 // Load and launch the chrome dll. *Everything* happens inside. |
260 VLOG(1) << "About to load main DLL."; | 260 VLOG(1) << "About to load main DLL."; |
261 MainDllLoader* loader = MakeMainDllLoader(); | 261 MainDllLoader* loader = MakeMainDllLoader(); |
262 int rc = loader->Launch(instance); | 262 int rc = loader->Launch(instance); |
263 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 263 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
264 delete loader; | 264 delete loader; |
265 return rc; | 265 return rc; |
266 } | 266 } |
OLD | NEW |