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" | |
21 #include "chrome/install_static/install_util.h" | 20 #include "chrome/install_static/install_util.h" |
22 #include "components/crash/content/app/crashpad.h" | 21 #include "components/crash/content/app/crashpad.h" |
23 #include "components/crash/core/common/crash_keys.h" | 22 #include "components/crash/core/common/crash_keys.h" |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 // TODO(ananta) | 26 // TODO(ananta) |
28 // When the new crash key map implementation lands, we should remove the | 27 // When the new crash key map implementation lands, we should remove the |
29 // constants defined below, the RegisterCrashKeysHelper function, the | 28 // constants defined below, the RegisterCrashKeysHelper function, the |
30 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface | 29 // RegisterCrashKeys function in the crash_keys::CrashReporterClient interface |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 309 |
311 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); | 310 install_static::SetEnvironmentString16(install_static::kShowRestart, L"1"); |
312 return true; | 311 return true; |
313 } | 312 } |
314 | 313 |
315 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( | 314 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( |
316 bool is_per_user_install) { | 315 bool is_per_user_install) { |
317 return false; | 316 return false; |
318 } | 317 } |
319 | 318 |
320 // TODO(grt): Remove |exe_path| from crash_reporter::CrashReporterClient. | |
321 bool ChromeCrashReporterClient::GetIsPerUserInstall( | 319 bool ChromeCrashReporterClient::GetIsPerUserInstall( |
322 const base::string16& exe_path) { | 320 const base::string16& exe_path) { |
323 return !install_static::InstallDetails::Get().system_level(); | 321 return !install_static::IsSystemInstall(exe_path.c_str()); |
324 } | 322 } |
325 | 323 |
326 // TODO(grt): Remove |is_per_user_install| from | |
327 // crash_reporter::CrashReporterClient. | |
328 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( | 324 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( |
329 bool is_per_user_install) { | 325 bool is_per_user_install) { |
330 // Capture larger dumps for Google Chrome "beta", "dev", and "canary" | 326 base::string16 channel_name; |
331 // channels. Stable channel and Chromium builds are on channel "", and use | 327 install_static::GetChromeChannelName(is_per_user_install, |
332 // smaller dumps. | 328 false, // !add_modifier |
333 return !install_static::InstallDetails::Get().channel().empty(); | 329 &channel_name); |
| 330 // Capture more detail in crash dumps for Beta, Dev, Canary channels and |
| 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); |
334 } | 336 } |
335 | 337 |
336 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { | 338 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { |
337 return chrome::RESULT_CODE_RESPAWN_FAILED; | 339 return chrome::RESULT_CODE_RESPAWN_FAILED; |
338 } | 340 } |
339 | 341 |
340 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( | 342 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |
341 bool* crashpad_enabled) { | 343 bool* crashpad_enabled) { |
342 // Determine whether configuration management allows loading the crash | 344 // Determine whether configuration management allows loading the crash |
343 // reporter. | 345 // reporter. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 bool ChromeCrashReporterClient::GetCollectStatsInSample() { | 390 bool ChromeCrashReporterClient::GetCollectStatsInSample() { |
389 return install_static::GetCollectStatsInSample(); | 391 return install_static::GetCollectStatsInSample(); |
390 } | 392 } |
391 | 393 |
392 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 394 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
393 const std::string& process_type) { | 395 const std::string& process_type) { |
394 return process_type == install_static::kRendererProcess || | 396 return process_type == install_static::kRendererProcess || |
395 process_type == install_static::kPpapiPluginProcess || | 397 process_type == install_static::kPpapiPluginProcess || |
396 process_type == install_static::kGpuProcess; | 398 process_type == install_static::kGpuProcess; |
397 } | 399 } |
OLD | NEW |