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