| 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_breakpad_client.h" | 5 #include "chrome/app/chrome_crash_reporter_client.h" |
| 6 | 6 |
| 7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/safe_sprintf.h" | 14 #include "base/strings/safe_sprintf.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // These registry key to which we'll write a value for each crash dump attempt. | 70 // These registry key to which we'll write a value for each crash dump attempt. |
| 71 HKEY g_browser_crash_dump_regkey = NULL; | 71 HKEY g_browser_crash_dump_regkey = NULL; |
| 72 | 72 |
| 73 // A atomic counter to make each crash dump value name unique. | 73 // A atomic counter to make each crash dump value name unique. |
| 74 base::subtle::Atomic32 g_browser_crash_dump_count = 0; | 74 base::subtle::Atomic32 g_browser_crash_dump_count = 0; |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| 79 ChromeBreakpadClient::ChromeBreakpadClient() {} | 79 ChromeCrashReporterClient::ChromeCrashReporterClient() {} |
| 80 | 80 |
| 81 ChromeBreakpadClient::~ChromeBreakpadClient() {} | 81 ChromeCrashReporterClient::~ChromeCrashReporterClient() {} |
| 82 | 82 |
| 83 void ChromeBreakpadClient::SetBreakpadClientIdFromGUID( | 83 void ChromeCrashReporterClient::SetCrashReporterClientIdFromGUID( |
| 84 const std::string& client_guid) { | 84 const std::string& client_guid) { |
| 85 crash_keys::SetCrashClientIdFromGUID(client_guid); | 85 crash_keys::SetCrashClientIdFromGUID(client_guid); |
| 86 } | 86 } |
| 87 | 87 |
| 88 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
| 89 bool ChromeBreakpadClient::GetAlternativeCrashDumpLocation( | 89 bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation( |
| 90 base::FilePath* crash_dir) { | 90 base::FilePath* crash_dir) { |
| 91 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate | 91 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
| 92 // location to write breakpad crash dumps can be set. | 92 // location to write breakpad crash dumps can be set. |
| 93 scoped_ptr<base::Environment> env(base::Environment::Create()); | 93 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 94 std::string alternate_crash_dump_location; | 94 std::string alternate_crash_dump_location; |
| 95 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { | 95 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { |
| 96 *crash_dir = base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); | 96 *crash_dir = base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ChromeBreakpadClient::GetProductNameAndVersion( | 103 void ChromeCrashReporterClient::GetProductNameAndVersion( |
| 104 const base::FilePath& exe_path, | 104 const base::FilePath& exe_path, |
| 105 base::string16* product_name, | 105 base::string16* product_name, |
| 106 base::string16* version, | 106 base::string16* version, |
| 107 base::string16* special_build, | 107 base::string16* special_build, |
| 108 base::string16* channel_name) { | 108 base::string16* channel_name) { |
| 109 DCHECK(product_name); | 109 DCHECK(product_name); |
| 110 DCHECK(version); | 110 DCHECK(version); |
| 111 DCHECK(special_build); | 111 DCHECK(special_build); |
| 112 DCHECK(channel_name); | 112 DCHECK(channel_name); |
| 113 | 113 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 125 } else { | 125 } else { |
| 126 // No version info found. Make up the values. | 126 // No version info found. Make up the values. |
| 127 *product_name = base::ASCIIToUTF16("Chrome"); | 127 *product_name = base::ASCIIToUTF16("Chrome"); |
| 128 *version = base::ASCIIToUTF16("0.0.0.0-devel"); | 128 *version = base::ASCIIToUTF16("0.0.0.0-devel"); |
| 129 } | 129 } |
| 130 | 130 |
| 131 GoogleUpdateSettings::GetChromeChannelAndModifiers( | 131 GoogleUpdateSettings::GetChromeChannelAndModifiers( |
| 132 !GetIsPerUserInstall(exe_path), channel_name); | 132 !GetIsPerUserInstall(exe_path), channel_name); |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool ChromeBreakpadClient::ShouldShowRestartDialog(base::string16* title, | 135 bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title, |
| 136 base::string16* message, | 136 base::string16* message, |
| 137 bool* is_rtl_locale) { | 137 bool* is_rtl_locale) { |
| 138 scoped_ptr<base::Environment> env(base::Environment::Create()); | 138 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 139 if (!env->HasVar(env_vars::kShowRestart) || | 139 if (!env->HasVar(env_vars::kShowRestart) || |
| 140 !env->HasVar(env_vars::kRestartInfo) || | 140 !env->HasVar(env_vars::kRestartInfo) || |
| 141 env->HasVar(env_vars::kMetroConnected)) { | 141 env->HasVar(env_vars::kMetroConnected)) { |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 std::string restart_info; | 145 std::string restart_info; |
| 146 env->GetVar(env_vars::kRestartInfo, &restart_info); | 146 env->GetVar(env_vars::kRestartInfo, &restart_info); |
| 147 | 147 |
| 148 // The CHROME_RESTART var contains the dialog strings separated by '|'. | 148 // The CHROME_RESTART var contains the dialog strings separated by '|'. |
| 149 // See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment() | 149 // See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment() |
| 150 // for details. | 150 // for details. |
| 151 std::vector<std::string> dlg_strings; | 151 std::vector<std::string> dlg_strings; |
| 152 base::SplitString(restart_info, '|', &dlg_strings); | 152 base::SplitString(restart_info, '|', &dlg_strings); |
| 153 | 153 |
| 154 if (dlg_strings.size() < 3) | 154 if (dlg_strings.size() < 3) |
| 155 return false; | 155 return false; |
| 156 | 156 |
| 157 *title = base::UTF8ToUTF16(dlg_strings[0]); | 157 *title = base::UTF8ToUTF16(dlg_strings[0]); |
| 158 *message = base::UTF8ToUTF16(dlg_strings[1]); | 158 *message = base::UTF8ToUTF16(dlg_strings[1]); |
| 159 *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale; | 159 *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale; |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool ChromeBreakpadClient::AboutToRestart() { | 163 bool ChromeCrashReporterClient::AboutToRestart() { |
| 164 scoped_ptr<base::Environment> env(base::Environment::Create()); | 164 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 165 if (!env->HasVar(env_vars::kRestartInfo)) | 165 if (!env->HasVar(env_vars::kRestartInfo)) |
| 166 return false; | 166 return false; |
| 167 | 167 |
| 168 env->SetVar(env_vars::kShowRestart, "1"); | 168 env->SetVar(env_vars::kShowRestart, "1"); |
| 169 return true; | 169 return true; |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool ChromeBreakpadClient::GetDeferredUploadsSupported( | 172 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( |
| 173 bool is_per_user_install) { | 173 bool is_per_user_install) { |
| 174 Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion( | 174 Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion( |
| 175 !is_per_user_install); | 175 !is_per_user_install); |
| 176 if (!update_version.IsValid() || | 176 if (!update_version.IsValid() || |
| 177 update_version.IsOlderThan(std::string(kMinUpdateVersion))) | 177 update_version.IsOlderThan(std::string(kMinUpdateVersion))) |
| 178 return false; | 178 return false; |
| 179 | 179 |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool ChromeBreakpadClient::GetIsPerUserInstall(const base::FilePath& exe_path) { | 183 bool ChromeCrashReporterClient::GetIsPerUserInstall( |
| 184 const base::FilePath& exe_path) { |
| 184 return InstallUtil::IsPerUserInstall(exe_path.value().c_str()); | 185 return InstallUtil::IsPerUserInstall(exe_path.value().c_str()); |
| 185 } | 186 } |
| 186 | 187 |
| 187 bool ChromeBreakpadClient::GetShouldDumpLargerDumps(bool is_per_user_install) { | 188 bool ChromeCrashReporterClient::GetShouldDumpLargerDumps( |
| 189 bool is_per_user_install) { |
| 188 base::string16 channel_name = | 190 base::string16 channel_name = |
| 189 GoogleUpdateSettings::GetChromeChannel(!is_per_user_install); | 191 GoogleUpdateSettings::GetChromeChannel(!is_per_user_install); |
| 190 | 192 |
| 191 // Capture more detail in crash dumps for beta and dev channel builds. | 193 // Capture more detail in crash dumps for beta and dev channel builds. |
| 192 return (channel_name == installer::kChromeChannelDev || | 194 return (channel_name == installer::kChromeChannelDev || |
| 193 channel_name == installer::kChromeChannelBeta || | 195 channel_name == installer::kChromeChannelBeta || |
| 194 channel_name == GoogleChromeSxSDistribution::ChannelName()); | 196 channel_name == GoogleChromeSxSDistribution::ChannelName()); |
| 195 } | 197 } |
| 196 | 198 |
| 197 int ChromeBreakpadClient::GetResultCodeRespawnFailed() { | 199 int ChromeCrashReporterClient::GetResultCodeRespawnFailed() { |
| 198 return chrome::RESULT_CODE_RESPAWN_FAILED; | 200 return chrome::RESULT_CODE_RESPAWN_FAILED; |
| 199 } | 201 } |
| 200 | 202 |
| 201 void ChromeBreakpadClient::InitBrowserCrashDumpsRegKey() { | 203 void ChromeCrashReporterClient::InitBrowserCrashDumpsRegKey() { |
| 202 DCHECK(g_browser_crash_dump_regkey == NULL); | 204 DCHECK(g_browser_crash_dump_regkey == NULL); |
| 203 | 205 |
| 204 base::win::RegKey regkey; | 206 base::win::RegKey regkey; |
| 205 if (regkey.Create(HKEY_CURRENT_USER, | 207 if (regkey.Create(HKEY_CURRENT_USER, |
| 206 chrome::kBrowserCrashDumpAttemptsRegistryPath, | 208 chrome::kBrowserCrashDumpAttemptsRegistryPath, |
| 207 KEY_ALL_ACCESS) != ERROR_SUCCESS) { | 209 KEY_ALL_ACCESS) != ERROR_SUCCESS) { |
| 208 return; | 210 return; |
| 209 } | 211 } |
| 210 | 212 |
| 211 // We use the current process id and the current tick count as a (hopefully) | 213 // We use the current process id and the current tick count as a (hopefully) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 222 if (length <= 0) { | 224 if (length <= 0) { |
| 223 NOTREACHED(); | 225 NOTREACHED(); |
| 224 g_browser_crash_dump_prefix[0] = '\0'; | 226 g_browser_crash_dump_prefix[0] = '\0'; |
| 225 return; | 227 return; |
| 226 } | 228 } |
| 227 | 229 |
| 228 // Hold the registry key in a global for update on crash dump. | 230 // Hold the registry key in a global for update on crash dump. |
| 229 g_browser_crash_dump_regkey = regkey.Take(); | 231 g_browser_crash_dump_regkey = regkey.Take(); |
| 230 } | 232 } |
| 231 | 233 |
| 232 void ChromeBreakpadClient::RecordCrashDumpAttempt(bool is_real_crash) { | 234 void ChromeCrashReporterClient::RecordCrashDumpAttempt(bool is_real_crash) { |
| 233 // If we're not a browser (or the registry is unavailable to us for some | 235 // If we're not a browser (or the registry is unavailable to us for some |
| 234 // reason) then there's nothing to do. | 236 // reason) then there's nothing to do. |
| 235 if (g_browser_crash_dump_regkey == NULL) | 237 if (g_browser_crash_dump_regkey == NULL) |
| 236 return; | 238 return; |
| 237 | 239 |
| 238 // Generate the final value name we'll use (appends the crash number to the | 240 // Generate the final value name we'll use (appends the crash number to the |
| 239 // base value name). | 241 // base value name). |
| 240 const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength; | 242 const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength; |
| 241 char value_name[kMaxValueSize + 1] = {}; | 243 char value_name[kMaxValueSize + 1] = {}; |
| 242 int length = base::strings::SafeSPrintf( | 244 int length = base::strings::SafeSPrintf( |
| 243 value_name, | 245 value_name, |
| 244 "%s-%x", | 246 "%s-%x", |
| 245 g_browser_crash_dump_prefix, | 247 g_browser_crash_dump_prefix, |
| 246 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1)); | 248 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1)); |
| 247 | 249 |
| 248 if (length > 0) { | 250 if (length > 0) { |
| 249 DWORD value_dword = is_real_crash ? 1 : 0; | 251 DWORD value_dword = is_real_crash ? 1 : 0; |
| 250 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD, | 252 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD, |
| 251 reinterpret_cast<BYTE*>(&value_dword), | 253 reinterpret_cast<BYTE*>(&value_dword), |
| 252 sizeof(value_dword)); | 254 sizeof(value_dword)); |
| 253 } | 255 } |
| 254 } | 256 } |
| 255 | 257 |
| 256 bool ChromeBreakpadClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) { | 258 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |
| 259 bool* breakpad_enabled) { |
| 257 // Determine whether configuration management allows loading the crash reporter. | 260 // Determine whether configuration management allows loading the crash reporter. |
| 258 // Since the configuration management infrastructure is not initialized at this | 261 // Since the configuration management infrastructure is not initialized at this |
| 259 // point, we read the corresponding registry key directly. The return status | 262 // point, we read the corresponding registry key directly. The return status |
| 260 // indicates whether policy data was successfully read. If it is true, | 263 // indicates whether policy data was successfully read. If it is true, |
| 261 // |breakpad_enabled| contains the value set by policy. | 264 // |breakpad_enabled| contains the value set by policy. |
| 262 base::string16 key_name = | 265 base::string16 key_name = |
| 263 base::UTF8ToUTF16(policy::key::kMetricsReportingEnabled); | 266 base::UTF8ToUTF16(policy::key::kMetricsReportingEnabled); |
| 264 DWORD value = 0; | 267 DWORD value = 0; |
| 265 base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE, | 268 base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE, |
| 266 policy::kRegistryChromePolicyKey, KEY_READ); | 269 policy::kRegistryChromePolicyKey, KEY_READ); |
| 267 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { | 270 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
| 268 *breakpad_enabled = value != 0; | 271 *breakpad_enabled = value != 0; |
| 269 return true; | 272 return true; |
| 270 } | 273 } |
| 271 | 274 |
| 272 base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER, | 275 base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER, |
| 273 policy::kRegistryChromePolicyKey, KEY_READ); | 276 policy::kRegistryChromePolicyKey, KEY_READ); |
| 274 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { | 277 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
| 275 *breakpad_enabled = value != 0; | 278 *breakpad_enabled = value != 0; |
| 276 return true; | 279 return true; |
| 277 } | 280 } |
| 278 | 281 |
| 279 return false; | 282 return false; |
| 280 } | 283 } |
| 281 #endif // defined(OS_WIN) | 284 #endif // defined(OS_WIN) |
| 282 | 285 |
| 283 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) | 286 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) |
| 284 void ChromeBreakpadClient::GetProductNameAndVersion(std::string* product_name, | 287 void ChromeCrashReporterClient::GetProductNameAndVersion( |
| 285 std::string* version) { | 288 std::string* product_name, |
| 289 std::string* version) { |
| 286 DCHECK(product_name); | 290 DCHECK(product_name); |
| 287 DCHECK(version); | 291 DCHECK(version); |
| 288 #if defined(OS_ANDROID) | 292 #if defined(OS_ANDROID) |
| 289 *product_name = "Chrome_Android"; | 293 *product_name = "Chrome_Android"; |
| 290 #elif defined(OS_CHROMEOS) | 294 #elif defined(OS_CHROMEOS) |
| 291 *product_name = "Chrome_ChromeOS"; | 295 *product_name = "Chrome_ChromeOS"; |
| 292 #else // OS_LINUX | 296 #else // OS_LINUX |
| 293 #if !defined(ADDRESS_SANITIZER) | 297 #if !defined(ADDRESS_SANITIZER) |
| 294 *product_name = "Chrome_Linux"; | 298 *product_name = "Chrome_Linux"; |
| 295 #else | 299 #else |
| 296 *product_name = "Chrome_Linux_ASan"; | 300 *product_name = "Chrome_Linux_ASan"; |
| 297 #endif | 301 #endif |
| 298 #endif | 302 #endif |
| 299 | 303 |
| 300 *version = PRODUCT_VERSION; | 304 *version = PRODUCT_VERSION; |
| 301 } | 305 } |
| 302 | 306 |
| 303 base::FilePath ChromeBreakpadClient::GetReporterLogFilename() { | 307 base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { |
| 304 return base::FilePath(CrashUploadList::kReporterLogFilename); | 308 return base::FilePath(CrashUploadList::kReporterLogFilename); |
| 305 } | 309 } |
| 306 #endif | 310 #endif |
| 307 | 311 |
| 308 bool ChromeBreakpadClient::GetCrashDumpLocation(base::FilePath* crash_dir) { | 312 bool ChromeCrashReporterClient::GetCrashDumpLocation( |
| 313 base::FilePath* crash_dir) { |
| 309 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate | 314 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
| 310 // location to write breakpad crash dumps can be set. | 315 // location to write breakpad crash dumps can be set. |
| 311 scoped_ptr<base::Environment> env(base::Environment::Create()); | 316 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 312 std::string alternate_crash_dump_location; | 317 std::string alternate_crash_dump_location; |
| 313 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { | 318 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { |
| 314 base::FilePath crash_dumps_dir_path = | 319 base::FilePath crash_dumps_dir_path = |
| 315 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); | 320 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); |
| 316 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); | 321 PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path); |
| 317 } | 322 } |
| 318 | 323 |
| 319 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); | 324 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); |
| 320 } | 325 } |
| 321 | 326 |
| 322 size_t ChromeBreakpadClient::RegisterCrashKeys() { | 327 size_t ChromeCrashReporterClient::RegisterCrashKeys() { |
| 323 // Note: This is not called on Windows because Breakpad is initialized in the | 328 // Note: This is not called on Windows because Breakpad is initialized in the |
| 324 // EXE module, but code that uses crash keys is in the DLL module. | 329 // EXE module, but code that uses crash keys is in the DLL module. |
| 325 // RegisterChromeCrashKeys() will be called after the DLL is loaded. | 330 // RegisterChromeCrashKeys() will be called after the DLL is loaded. |
| 326 return crash_keys::RegisterChromeCrashKeys(); | 331 return crash_keys::RegisterChromeCrashKeys(); |
| 327 } | 332 } |
| 328 | 333 |
| 329 bool ChromeBreakpadClient::IsRunningUnattended() { | 334 bool ChromeCrashReporterClient::IsRunningUnattended() { |
| 330 scoped_ptr<base::Environment> env(base::Environment::Create()); | 335 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 331 return env->HasVar(env_vars::kHeadless); | 336 return env->HasVar(env_vars::kHeadless); |
| 332 } | 337 } |
| 333 | 338 |
| 334 bool ChromeBreakpadClient::GetCollectStatsConsent() { | 339 bool ChromeCrashReporterClient::GetCollectStatsConsent() { |
| 335 #if defined(GOOGLE_CHROME_BUILD) | 340 #if defined(GOOGLE_CHROME_BUILD) |
| 336 bool is_official_chrome_build = true; | 341 bool is_official_chrome_build = true; |
| 337 #else | 342 #else |
| 338 bool is_official_chrome_build = false; | 343 bool is_official_chrome_build = false; |
| 339 #endif | 344 #endif |
| 340 | 345 |
| 341 #if defined(OS_CHROMEOS) | 346 #if defined(OS_CHROMEOS) |
| 342 bool is_guest_session = CommandLine::ForCurrentProcess()->HasSwitch( | 347 bool is_guest_session = CommandLine::ForCurrentProcess()->HasSwitch( |
| 343 chromeos::switches::kGuestSession); | 348 chromeos::switches::kGuestSession); |
| 344 bool is_stable_channel = | 349 bool is_stable_channel = |
| 345 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 350 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 346 | 351 |
| 347 if (is_guest_session && is_stable_channel) | 352 if (is_guest_session && is_stable_channel) |
| 348 return false; | 353 return false; |
| 349 #endif // defined(OS_CHROMEOS) | 354 #endif // defined(OS_CHROMEOS) |
| 350 | 355 |
| 351 #if defined(OS_ANDROID) | 356 #if defined(OS_ANDROID) |
| 352 // TODO(jcivelli): we should not initialize the crash-reporter when it was not | 357 // TODO(jcivelli): we should not initialize the crash-reporter when it was not |
| 353 // enabled. Right now if it is disabled we still generate the minidumps but we | 358 // enabled. Right now if it is disabled we still generate the minidumps but we |
| 354 // do not upload them. | 359 // do not upload them. |
| 355 return is_official_chrome_build; | 360 return is_official_chrome_build; |
| 356 #else // !defined(OS_ANDROID) | 361 #else // !defined(OS_ANDROID) |
| 357 return is_official_chrome_build && | 362 return is_official_chrome_build && |
| 358 GoogleUpdateSettings::GetCollectStatsConsent(); | 363 GoogleUpdateSettings::GetCollectStatsConsent(); |
| 359 #endif // defined(OS_ANDROID) | 364 #endif // defined(OS_ANDROID) |
| 360 } | 365 } |
| 361 | 366 |
| 362 #if defined(OS_ANDROID) | 367 #if defined(OS_ANDROID) |
| 363 int ChromeBreakpadClient::GetAndroidMinidumpDescriptor() { | 368 int ChromeCrashReporterClient::GetAndroidMinidumpDescriptor() { |
| 364 return kAndroidMinidumpDescriptor; | 369 return kAndroidMinidumpDescriptor; |
| 365 } | 370 } |
| 366 #endif | 371 #endif |
| 367 | 372 |
| 368 bool ChromeBreakpadClient::EnableBreakpadForProcess( | 373 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 369 const std::string& process_type) { | 374 const std::string& process_type) { |
| 370 return process_type == switches::kRendererProcess || | 375 return process_type == switches::kRendererProcess || |
| 371 process_type == switches::kPluginProcess || | 376 process_type == switches::kPluginProcess || |
| 372 process_type == switches::kPpapiPluginProcess || | 377 process_type == switches::kPpapiPluginProcess || |
| 373 process_type == switches::kZygoteProcess || | 378 process_type == switches::kZygoteProcess || |
| 374 process_type == switches::kGpuProcess; | 379 process_type == switches::kGpuProcess; |
| 375 } | 380 } |
| 376 | 381 |
| 377 } // namespace chrome | 382 } // namespace chrome |
| OLD | NEW |