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 | 4 |
5 #include "chrome/app/main_dll_loader_win.h" | 5 #include "chrome/app/main_dll_loader_win.h" |
6 | 6 |
7 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
8 #include <shlwapi.h> // NOLINT | 8 #include <shlwapi.h> // NOLINT |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <userenv.h> // NOLINT | 10 #include <userenv.h> // NOLINT |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
37 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
38 #include "chrome/common/chrome_result_codes.h" | 38 #include "chrome/common/chrome_result_codes.h" |
39 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/metrics_constants_util_win.h" | 40 #include "chrome/common/metrics_constants_util_win.h" |
41 #include "chrome/installer/util/google_update_constants.h" | 41 #include "chrome/installer/util/google_update_constants.h" |
42 #include "chrome/installer/util/google_update_settings.h" | 42 #include "chrome/installer/util/google_update_settings.h" |
43 #include "chrome/installer/util/install_util.h" | 43 #include "chrome/installer/util/install_util.h" |
44 #include "chrome/installer/util/module_util_win.h" | 44 #include "chrome/installer/util/module_util_win.h" |
45 #include "chrome/installer/util/util_constants.h" | 45 #include "chrome/installer/util/util_constants.h" |
46 #include "components/crash/content/app/crash_reporter_client.h" | |
47 #include "components/crash/content/app/crashpad.h" | |
48 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | 46 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
49 #include "content/public/app/sandbox_helper_win.h" | 47 #include "content/public/app/sandbox_helper_win.h" |
50 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
51 #include "sandbox/win/src/sandbox.h" | 49 #include "sandbox/win/src/sandbox.h" |
52 | 50 |
53 namespace { | 51 namespace { |
54 // The entry point signature of chrome.dll. | 52 // The entry point signature of chrome.dll. |
55 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); | 53 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); |
56 | 54 |
57 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); | 55 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 #if BUILDFLAG(ENABLE_KASKO) | 215 #if BUILDFLAG(ENABLE_KASKO) |
218 std::unique_ptr<KaskoClient> kasko_client_; | 216 std::unique_ptr<KaskoClient> kasko_client_; |
219 #endif | 217 #endif |
220 }; | 218 }; |
221 | 219 |
222 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, | 220 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, |
223 const base::FilePath& dll_path) { | 221 const base::FilePath& dll_path) { |
224 if (process_type.empty()) { | 222 if (process_type.empty()) { |
225 RecordDidRun(dll_path); | 223 RecordDidRun(dll_path); |
226 | 224 |
| 225 typedef bool (*GetUploadsEnabledFunction)(void); |
| 226 static GetUploadsEnabledFunction get_uploads_enabled = nullptr; |
| 227 if (!get_uploads_enabled) { |
| 228 get_uploads_enabled = reinterpret_cast<GetUploadsEnabledFunction>( |
| 229 GetProcAddress(GetModuleHandle(chrome::kChromeElfDllName), |
| 230 "GetUploadsEnabled")); |
| 231 CHECK(get_uploads_enabled); |
| 232 } |
| 233 |
227 // Launch the watcher process if stats collection consent has been granted. | 234 // Launch the watcher process if stats collection consent has been granted. |
228 if (crash_reporter::GetUploadsEnabled()) { | 235 if (get_uploads_enabled()) { |
229 base::FilePath exe_path; | 236 base::FilePath exe_path; |
230 if (PathService::Get(base::FILE_EXE, &exe_path)) { | 237 if (PathService::Get(base::FILE_EXE, &exe_path)) { |
231 chrome_watcher_client_.reset(new ChromeWatcherClient( | 238 chrome_watcher_client_.reset(new ChromeWatcherClient( |
232 base::Bind(&GenerateChromeWatcherCommandLine, exe_path))); | 239 base::Bind(&GenerateChromeWatcherCommandLine, exe_path))); |
233 if (chrome_watcher_client_->LaunchWatcher()) { | 240 if (chrome_watcher_client_->LaunchWatcher()) { |
234 #if BUILDFLAG(ENABLE_KASKO) | 241 #if BUILDFLAG(ENABLE_KASKO) |
235 kasko::api::MinidumpType minidump_type = kasko::api::SMALL_DUMP_TYPE; | 242 kasko::api::MinidumpType minidump_type = kasko::api::SMALL_DUMP_TYPE; |
236 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 243 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
237 switches::kFullMemoryCrashReport)) { | 244 switches::kFullMemoryCrashReport)) { |
238 minidump_type = kasko::api::FULL_DUMP_TYPE; | 245 minidump_type = kasko::api::FULL_DUMP_TYPE; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 299 } |
293 }; | 300 }; |
294 | 301 |
295 MainDllLoader* MakeMainDllLoader() { | 302 MainDllLoader* MakeMainDllLoader() { |
296 #if defined(GOOGLE_CHROME_BUILD) | 303 #if defined(GOOGLE_CHROME_BUILD) |
297 return new ChromeDllLoader(); | 304 return new ChromeDllLoader(); |
298 #else | 305 #else |
299 return new ChromiumDllLoader(); | 306 return new ChromiumDllLoader(); |
300 #endif | 307 #endif |
301 } | 308 } |
OLD | NEW |