OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_crash_reporter_client.h" | 5 #include "chrome/app/chrome_crash_reporter_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/common/chrome_result_codes.h" | 16 #include "chrome/common/chrome_result_codes.h" |
17 #include "chrome/common/crash_keys.h" | 17 #include "chrome/common/crash_keys.h" |
18 #include "chrome/common/env_vars.h" | 18 #include "chrome/common/env_vars.h" |
19 #include "chrome/installer/util/browser_distribution.h" | |
19 #include "chrome/installer/util/google_update_settings.h" | 20 #include "chrome/installer/util/google_update_settings.h" |
20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
21 | 22 |
22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
23 #include <windows.h> | 24 #include <windows.h> |
24 | 25 |
25 #include "base/file_version_info.h" | 26 #include "base/file_version_info.h" |
26 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
27 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 28 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
28 #include "chrome/installer/util/install_util.h" | 29 #include "chrome/installer/util/install_util.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 *version = PRODUCT_VERSION; | 272 *version = PRODUCT_VERSION; |
272 } | 273 } |
273 | 274 |
274 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { | 275 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { |
275 return base::FilePath(CrashUploadList::kReporterLogFilename); | 276 return base::FilePath(CrashUploadList::kReporterLogFilename); |
276 } | 277 } |
277 #endif | 278 #endif |
278 | 279 |
279 bool ChromeCrashReporterClient::GetCrashDumpLocation( | 280 bool ChromeCrashReporterClient::GetCrashDumpLocation( |
280 base::FilePath* crash_dir) { | 281 base::FilePath* crash_dir) { |
282 #if defined(OS_WIN) | |
283 // In order to be able to start crash handling very early, we do not rely on | |
284 // the chrome's PathService entries (for DIR_CRASH_DUMPS) being available on | |
Mark Mentovai
2015/12/03 15:11:32
Lose “the”.
scottmg
2015/12/03 18:14:51
Done.
| |
285 // Windows. See http://crbug.com/564398. | |
286 base::FilePath result; | |
287 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, &result)) | |
Mark Mentovai
2015/12/03 15:11:32
Following up on the --user-data-dir discussion:
T
scottmg
2015/12/03 18:14:51
Yeah, that's a good point. I filed crbug.com/56546
| |
288 return false; | |
289 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
290 result = result.Append(dist->GetInstallSubDir()); | |
291 result = result.Append(chrome::kUserDataDirname); | |
292 result = result.Append(FILE_PATH_LITERAL("Crashpad")); | |
293 *crash_dir = result; | |
294 return true; | |
295 #else | |
281 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate | 296 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
282 // location to write breakpad crash dumps can be set. | 297 // location to write breakpad crash dumps can be set. |
283 scoped_ptr<base::Environment> env(base::Environment::Create()); | 298 scoped_ptr<base::Environment> env(base::Environment::Create()); |
284 std::string alternate_crash_dump_location; | 299 std::string alternate_crash_dump_location; |
285 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { | 300 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { |
286 base::FilePath crash_dumps_dir_path = | 301 base::FilePath crash_dumps_dir_path = |
287 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); | 302 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); |
288 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); | 303 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); |
289 } | 304 } |
290 | 305 |
291 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); | 306 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); |
307 #endif | |
292 } | 308 } |
293 | 309 |
294 size_t ChromeCrashReporterClient::RegisterCrashKeys() { | 310 size_t ChromeCrashReporterClient::RegisterCrashKeys() { |
295 return crash_keys::RegisterChromeCrashKeys(); | 311 return crash_keys::RegisterChromeCrashKeys(); |
296 } | 312 } |
297 | 313 |
298 bool ChromeCrashReporterClient::IsRunningUnattended() { | 314 bool ChromeCrashReporterClient::IsRunningUnattended() { |
299 scoped_ptr<base::Environment> env(base::Environment::Create()); | 315 scoped_ptr<base::Environment> env(base::Environment::Create()); |
300 return env->HasVar(env_vars::kHeadless); | 316 return env->HasVar(env_vars::kHeadless); |
301 } | 317 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 #endif | 351 #endif |
336 | 352 |
337 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 353 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
338 const std::string& process_type) { | 354 const std::string& process_type) { |
339 return process_type == switches::kRendererProcess || | 355 return process_type == switches::kRendererProcess || |
340 process_type == switches::kPluginProcess || | 356 process_type == switches::kPluginProcess || |
341 process_type == switches::kPpapiPluginProcess || | 357 process_type == switches::kPpapiPluginProcess || |
342 process_type == switches::kZygoteProcess || | 358 process_type == switches::kZygoteProcess || |
343 process_type == switches::kGpuProcess; | 359 process_type == switches::kGpuProcess; |
344 } | 360 } |
OLD | NEW |