| 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_win.h" | 5 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/chrome_paths_internal.h" | 21 #include "chrome/common/chrome_paths_internal.h" |
| 22 #include "chrome/common/chrome_result_codes.h" | 22 #include "chrome/common/chrome_result_codes.h" |
| 23 #include "chrome/common/crash_keys.h" | 23 #include "chrome/common/crash_keys.h" |
| 24 #include "chrome/common/env_vars.h" | 24 #include "chrome/common/env_vars.h" |
| 25 #include "chrome/common/metrics_constants_util_win.h" | 25 #include "chrome/common/metrics_constants_util_win.h" |
| 26 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 26 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
| 27 #include "chrome/installer/util/google_update_settings.h" | 27 #include "chrome/installer/util/google_update_settings.h" |
| 28 #include "chrome/installer/util/install_util.h" | 28 #include "chrome/installer/util/install_util.h" |
| 29 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
| 30 #include "components/browser_watcher/crash_reporting_metrics_win.h" | |
| 31 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 32 #include "policy/policy_constants.h" | 31 #include "policy/policy_constants.h" |
| 33 | 32 |
| 34 | 33 |
| 35 namespace { | 34 namespace { |
| 36 | 35 |
| 37 // This is the minimum version of google update that is required for deferred | 36 // This is the minimum version of google update that is required for deferred |
| 38 // crash uploads to work. | 37 // crash uploads to work. |
| 39 const char kMinUpdateVersion[] = "1.3.21.115"; | 38 const char kMinUpdateVersion[] = "1.3.21.115"; |
| 40 | 39 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return (channel_name == installer::kChromeChannelBeta || | 152 return (channel_name == installer::kChromeChannelBeta || |
| 154 channel_name == installer::kChromeChannelDev || | 153 channel_name == installer::kChromeChannelDev || |
| 155 channel_name == GoogleChromeSxSDistribution::ChannelName() || | 154 channel_name == GoogleChromeSxSDistribution::ChannelName() || |
| 156 channel_name == installer::kChromeChannelUnknown); | 155 channel_name == installer::kChromeChannelUnknown); |
| 157 } | 156 } |
| 158 | 157 |
| 159 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { | 158 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { |
| 160 return chrome::RESULT_CODE_RESPAWN_FAILED; | 159 return chrome::RESULT_CODE_RESPAWN_FAILED; |
| 161 } | 160 } |
| 162 | 161 |
| 163 void ChromeCrashReporterClient::InitBrowserCrashDumpsRegKey() { | |
| 164 #if !defined(NACL_WIN64) | |
| 165 if (GetCollectStatsConsent()){ | |
| 166 crash_reporting_metrics_.reset(new browser_watcher::CrashReportingMetrics( | |
| 167 chrome::GetBrowserCrashDumpAttemptsRegistryPath())); | |
| 168 } | |
| 169 #endif | |
| 170 } | |
| 171 | |
| 172 void ChromeCrashReporterClient::RecordCrashDumpAttempt(bool is_real_crash) { | |
| 173 #if !defined(NACL_WIN64) | |
| 174 if (!crash_reporting_metrics_) | |
| 175 return; | |
| 176 | |
| 177 if (is_real_crash) | |
| 178 crash_reporting_metrics_->RecordCrashDumpAttempt(); | |
| 179 else | |
| 180 crash_reporting_metrics_->RecordDumpWithoutCrashAttempt(); | |
| 181 #endif | |
| 182 } | |
| 183 | |
| 184 void ChromeCrashReporterClient::RecordCrashDumpAttemptResult(bool is_real_crash, | |
| 185 bool succeeded) { | |
| 186 #if !defined(NACL_WIN64) | |
| 187 if (!crash_reporting_metrics_) | |
| 188 return; | |
| 189 | |
| 190 if (is_real_crash) | |
| 191 crash_reporting_metrics_->RecordCrashDumpAttemptResult(succeeded); | |
| 192 else | |
| 193 crash_reporting_metrics_->RecordDumpWithoutCrashAttemptResult(succeeded); | |
| 194 #endif | |
| 195 } | |
| 196 | |
| 197 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( | 162 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |
| 198 bool* breakpad_enabled) { | 163 bool* breakpad_enabled) { |
| 199 // Determine whether configuration management allows loading the crash reporter. | 164 // Determine whether configuration management allows loading the crash reporter. |
| 200 // Since the configuration management infrastructure is not initialized at this | 165 // Since the configuration management infrastructure is not initialized at this |
| 201 // point, we read the corresponding registry key directly. The return status | 166 // point, we read the corresponding registry key directly. The return status |
| 202 // indicates whether policy data was successfully read. If it is true, | 167 // indicates whether policy data was successfully read. If it is true, |
| 203 // |breakpad_enabled| contains the value set by policy. | 168 // |breakpad_enabled| contains the value set by policy. |
| 204 base::string16 key_name = | 169 base::string16 key_name = |
| 205 base::UTF8ToUTF16(policy::key::kMetricsReportingEnabled); | 170 base::UTF8ToUTF16(policy::key::kMetricsReportingEnabled); |
| 206 DWORD value = 0; | 171 DWORD value = 0; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 GoogleUpdateSettings::GetCollectStatsConsent(); | 230 GoogleUpdateSettings::GetCollectStatsConsent(); |
| 266 } | 231 } |
| 267 | 232 |
| 268 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 233 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 269 const std::string& process_type) { | 234 const std::string& process_type) { |
| 270 return process_type == switches::kRendererProcess || | 235 return process_type == switches::kRendererProcess || |
| 271 process_type == switches::kPpapiPluginProcess || | 236 process_type == switches::kPpapiPluginProcess || |
| 272 process_type == switches::kZygoteProcess || | 237 process_type == switches::kZygoteProcess || |
| 273 process_type == switches::kGpuProcess; | 238 process_type == switches::kGpuProcess; |
| 274 } | 239 } |
| OLD | NEW |