| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 310 |
| 310 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); | 311 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); |
| 311 return true; | 312 return true; |
| 312 } | 313 } |
| 313 | 314 |
| 314 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( | 315 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( |
| 315 bool is_per_user_install) { | 316 bool is_per_user_install) { |
| 316 return false; | 317 return false; |
| 317 } | 318 } |
| 318 | 319 |
| 320 // TODO(grt): Remove |exe_path| from crash_reporter::CrashReporterClient. |
| 319 bool ChromeCrashReporterClient::GetIsPerUserInstall( | 321 bool ChromeCrashReporterClient::GetIsPerUserInstall( |
| 320 const base::string16& exe_path) { | 322 const base::string16& exe_path) { |
| 321 return !install_static::IsSystemInstall(exe_path.c_str()); | 323 return !install_static::InstallDetails::Get().system_level(); |
| 322 } | 324 } |
| 323 | 325 |
| 326 // TODO(grt): Remove |is_per_user_install| from |
| 327 // crash_reporter::CrashReporterClient. |
| 324 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( | 328 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( |
| 325 bool is_per_user_install) { | 329 bool is_per_user_install) { |
| 326 base::string16 channel_name; | 330 // Capture larger dumps for: |
| 327 install_static::GetChromeChannelName(is_per_user_install, | 331 // - Chromium builds: "unknown" channel |
| 328 false, // !add_modifier | 332 // - Google Chrome builds: "beta", "dev", and "canary" channels. |
| 329 &channel_name); | 333 // That leaves stable channel, which is the empty string. |
| 330 // Capture more detail in crash dumps for Beta, Dev, Canary channels and | 334 return !install_static::InstallDetails::Get().channel().empty(); |
| 331 // if channel is unknown (e.g. Chromium or developer builds). | |
| 332 return (channel_name == install_static::kChromeChannelBeta || | |
| 333 channel_name == install_static::kChromeChannelDev || | |
| 334 channel_name == install_static::kChromeChannelCanary || | |
| 335 channel_name == install_static::kChromeChannelUnknown); | |
| 336 } | 335 } |
| 337 | 336 |
| 338 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { | 337 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { |
| 339 return chrome::RESULT_CODE_RESPAWN_FAILED; | 338 return chrome::RESULT_CODE_RESPAWN_FAILED; |
| 340 } | 339 } |
| 341 | 340 |
| 342 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( | 341 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |
| 343 bool* crashpad_enabled) { | 342 bool* crashpad_enabled) { |
| 344 // Determine whether configuration management allows loading the crash | 343 // Determine whether configuration management allows loading the crash |
| 345 // reporter. | 344 // reporter. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 bool ChromeCrashReporterClient::GetCollectStatsInSample() { | 389 bool ChromeCrashReporterClient::GetCollectStatsInSample() { |
| 391 return install_static::GetCollectStatsInSample(); | 390 return install_static::GetCollectStatsInSample(); |
| 392 } | 391 } |
| 393 | 392 |
| 394 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 393 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 395 const std::string& process_type) { | 394 const std::string& process_type) { |
| 396 return process_type == install_static::kRendererProcess || | 395 return process_type == install_static::kRendererProcess || |
| 397 process_type == install_static::kPpapiPluginProcess || | 396 process_type == install_static::kPpapiPluginProcess || |
| 398 process_type == install_static::kGpuProcess; | 397 process_type == install_static::kGpuProcess; |
| 399 } | 398 } |
| OLD | NEW |