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