| 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 // TODO(ananta/scottmg) | 5 // TODO(ananta/scottmg) |
| 6 // Add test coverage for Crashpad. | 6 // Add test coverage for Crashpad. |
| 7 #include "chrome/app/chrome_crash_reporter_client_win.h" | 7 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 8 | 8 |
| 9 #include <assert.h> | 9 #include <assert.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <shellapi.h> | 11 #include <shellapi.h> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/debug/crash_logging.h" | 16 #include "base/debug/crash_logging.h" |
| 17 #include "base/debug/leak_annotations.h" | 17 #include "base/debug/leak_annotations.h" |
| 18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
| 19 #include "chrome/common/chrome_result_codes.h" | 19 #include "chrome/common/chrome_result_codes.h" |
| 20 #include "chrome/install_static/install_details.h" |
| 20 #include "chrome/install_static/install_util.h" | 21 #include "chrome/install_static/install_util.h" |
| 21 #include "components/crash/content/app/crashpad.h" | 22 #include "components/crash/content/app/crashpad.h" |
| 22 #include "components/crash/core/common/crash_keys.h" | 23 #include "components/crash/core/common/crash_keys.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // TODO(ananta) | 27 // TODO(ananta) |
| 27 // When the new crash key map implementation lands, we should remove the | 28 // When the new crash key map implementation lands, we should remove the |
| 28 // constants defined below, the RegisterCrashKeysHelper function, the | 29 // constants defined below, the RegisterCrashKeysHelper function, the |
| 29 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface | 30 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 317 |
| 317 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); | 318 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); |
| 318 return true; | 319 return true; |
| 319 } | 320 } |
| 320 | 321 |
| 321 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( | 322 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( |
| 322 bool is_per_user_install) { | 323 bool is_per_user_install) { |
| 323 return false; | 324 return false; |
| 324 } | 325 } |
| 325 | 326 |
| 327 // TODO(grt): Remove |exe_path| from crash_reporter::CrashReporterClient. |
| 326 bool ChromeCrashReporterClient::GetIsPerUserInstall( | 328 bool ChromeCrashReporterClient::GetIsPerUserInstall( |
| 327 const base::string16& exe_path) { | 329 const base::string16& exe_path) { |
| 328 return !install_static::IsSystemInstall(exe_path.c_str()); | 330 return !install_static::InstallDetails::Get().system_level(); |
| 329 } | 331 } |
| 330 | 332 |
| 333 // TODO(grt): Remove |is_per_user_install| from |
| 334 // crash_reporter::CrashReporterClient. |
| 331 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( | 335 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( |
| 332 bool is_per_user_install) { | 336 bool is_per_user_install) { |
| 333 base::string16 channel_name; | 337 // Capture larger dumps for Google Chrome "beta", "dev", and "canary" |
| 334 install_static::GetChromeChannelName(is_per_user_install, | 338 // channels. Stable channel and Chromium builds are on channel "", and use |
| 335 false, // !add_modifier | 339 // smaller dumps. |
| 336 &channel_name); | 340 return !install_static::InstallDetails::Get().channel().empty(); |
| 337 // Capture more detail in crash dumps for Beta, Dev, Canary channels and | |
| 338 // if channel is unknown (e.g. Chromium or developer builds). | |
| 339 return (channel_name == install_static::kChromeChannelBeta || | |
| 340 channel_name == install_static::kChromeChannelDev || | |
| 341 channel_name == install_static::kChromeChannelCanary || | |
| 342 channel_name == install_static::kChromeChannelUnknown); | |
| 343 } | 341 } |
| 344 | 342 |
| 345 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { | 343 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { |
| 346 return chrome::RESULT_CODE_RESPAWN_FAILED; | 344 return chrome::RESULT_CODE_RESPAWN_FAILED; |
| 347 } | 345 } |
| 348 | 346 |
| 349 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( | 347 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |
| 350 bool* crashpad_enabled) { | 348 bool* crashpad_enabled) { |
| 351 // Determine whether configuration management allows loading the crash | 349 // Determine whether configuration management allows loading the crash |
| 352 // reporter. | 350 // reporter. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 bool ChromeCrashReporterClient::GetCollectStatsInSample() { | 395 bool ChromeCrashReporterClient::GetCollectStatsInSample() { |
| 398 return install_static::GetCollectStatsInSample(); | 396 return install_static::GetCollectStatsInSample(); |
| 399 } | 397 } |
| 400 | 398 |
| 401 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 399 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 402 const std::string& process_type) { | 400 const std::string& process_type) { |
| 403 return process_type == install_static::kRendererProcess || | 401 return process_type == install_static::kRendererProcess || |
| 404 process_type == install_static::kPpapiPluginProcess || | 402 process_type == install_static::kPpapiPluginProcess || |
| 405 process_type == install_static::kGpuProcess; | 403 process_type == install_static::kGpuProcess; |
| 406 } | 404 } |
| OLD | NEW |