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 "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/chrome_paths_internal.h" |
17 #include "chrome/common/chrome_result_codes.h" | 18 #include "chrome/common/chrome_result_codes.h" |
18 #include "chrome/common/crash_keys.h" | 19 #include "chrome/common/crash_keys.h" |
19 #include "chrome/common/env_vars.h" | 20 #include "chrome/common/env_vars.h" |
20 #include "chrome/installer/util/browser_distribution.h" | |
21 #include "chrome/installer/util/google_update_settings.h" | 21 #include "chrome/installer/util/google_update_settings.h" |
22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
23 | 23 |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 #include <windows.h> | 25 #include <windows.h> |
26 | 26 |
27 #include "base/file_version_info.h" | 27 #include "base/file_version_info.h" |
28 #include "base/win/registry.h" | 28 #include "base/win/registry.h" |
29 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 29 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
30 #include "chrome/installer/util/install_util.h" | 30 #include "chrome/installer/util/install_util.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 | 275 |
276 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { | 276 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { |
277 return base::FilePath(CrashUploadList::kReporterLogFilename); | 277 return base::FilePath(CrashUploadList::kReporterLogFilename); |
278 } | 278 } |
279 #endif | 279 #endif |
280 | 280 |
281 bool ChromeCrashReporterClient::GetCrashDumpLocation( | 281 bool ChromeCrashReporterClient::GetCrashDumpLocation( |
282 base::FilePath* crash_dir) { | 282 base::FilePath* crash_dir) { |
283 #if defined(OS_WIN) | 283 #if defined(OS_WIN) |
284 // In order to be able to start crash handling very early, we do not rely on | |
285 // chrome's PathService entries (for DIR_CRASH_DUMPS) being available on | |
286 // Windows. See https://crbug.com/564398. | |
287 base::FilePath result; | |
288 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, &result)) | |
289 return false; | |
290 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
291 result = result.Append(dist->GetInstallSubDir()); | |
292 // TODO(scottmg): Consider supporting --user-data-dir. See | 284 // TODO(scottmg): Consider supporting --user-data-dir. See |
293 // https://crbug.com/565446. | 285 // https://crbug.com/565446. |
294 result = result.Append(chrome::kUserDataDirname); | 286 return chrome::GetDefaultCrashDumpLocation(crash_dir); |
295 result = result.Append(FILE_PATH_LITERAL("Crashpad")); | |
296 *crash_dir = result; | |
297 return true; | |
298 #else | 287 #else |
299 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate | 288 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
300 // location to write breakpad crash dumps can be set. | 289 // location to write breakpad crash dumps can be set. |
301 scoped_ptr<base::Environment> env(base::Environment::Create()); | 290 scoped_ptr<base::Environment> env(base::Environment::Create()); |
302 std::string alternate_crash_dump_location; | 291 std::string alternate_crash_dump_location; |
303 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { | 292 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { |
304 base::FilePath crash_dumps_dir_path = | 293 base::FilePath crash_dumps_dir_path = |
305 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); | 294 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); |
306 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); | 295 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); |
307 } | 296 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 #endif | 343 #endif |
355 | 344 |
356 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 345 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
357 const std::string& process_type) { | 346 const std::string& process_type) { |
358 return process_type == switches::kRendererProcess || | 347 return process_type == switches::kRendererProcess || |
359 process_type == switches::kPluginProcess || | 348 process_type == switches::kPluginProcess || |
360 process_type == switches::kPpapiPluginProcess || | 349 process_type == switches::kPpapiPluginProcess || |
361 process_type == switches::kZygoteProcess || | 350 process_type == switches::kZygoteProcess || |
362 process_type == switches::kGpuProcess; | 351 process_type == switches::kGpuProcess; |
363 } | 352 } |
OLD | NEW |