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_breakpad_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" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // RegisterChromeCrashKeys() will be called after the DLL is loaded. | 327 // RegisterChromeCrashKeys() will be called after the DLL is loaded. |
328 return crash_keys::RegisterChromeCrashKeys(); | 328 return crash_keys::RegisterChromeCrashKeys(); |
329 } | 329 } |
330 | 330 |
331 bool ChromeBreakpadClient::IsRunningUnattended() { | 331 bool ChromeBreakpadClient::IsRunningUnattended() { |
332 scoped_ptr<base::Environment> env(base::Environment::Create()); | 332 scoped_ptr<base::Environment> env(base::Environment::Create()); |
333 return env->HasVar(env_vars::kHeadless); | 333 return env->HasVar(env_vars::kHeadless); |
334 } | 334 } |
335 | 335 |
336 bool ChromeBreakpadClient::GetCollectStatsConsent() { | 336 bool ChromeBreakpadClient::GetCollectStatsConsent() { |
337 // Convert #define to a variable so that we can use if() rather than | 337 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD) |
338 // #if below and so at least compile-test the Chrome code in | 338 bool is_official_chrome_build = true; |
339 // Chromium builds. | |
340 #if defined(GOOGLE_CHROME_BUILD) | |
341 bool is_chrome_build = true; | |
342 #else | 339 #else |
343 bool is_chrome_build = false; | 340 bool is_official_chrome_build = false; |
344 #endif | 341 #endif |
345 | 342 |
346 #if defined(OS_CHROMEOS) | 343 #if defined(OS_CHROMEOS) |
347 bool is_guest_session = CommandLine::ForCurrentProcess()->HasSwitch( | 344 bool is_guest_session = CommandLine::ForCurrentProcess()->HasSwitch( |
348 chromeos::switches::kGuestSession); | 345 chromeos::switches::kGuestSession); |
349 bool is_stable_channel = | 346 bool is_stable_channel = |
350 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 347 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
351 | 348 |
352 if (is_guest_session && is_stable_channel) | 349 if (is_guest_session && is_stable_channel) |
353 return false; | 350 return false; |
354 #endif // defined(OS_CHROMEOS) | 351 #endif // defined(OS_CHROMEOS) |
355 | 352 |
356 #if defined(OS_ANDROID) | 353 #if defined(OS_ANDROID) |
357 // TODO(jcivelli): we should not initialize the crash-reporter when it was not | 354 // TODO(jcivelli): we should not initialize the crash-reporter when it was not |
358 // enabled. Right now if it is disabled we still generate the minidumps but we | 355 // enabled. Right now if it is disabled we still generate the minidumps but we |
359 // do not upload them. | 356 // do not upload them. |
360 return is_chrome_build; | 357 return is_official_chrome_build; |
361 #else // !defined(OS_ANDROID) | 358 #else // !defined(OS_ANDROID) |
362 return is_chrome_build && GoogleUpdateSettings::GetCollectStatsConsent(); | 359 return is_official_chrome_build && |
| 360 GoogleUpdateSettings::GetCollectStatsConsent(); |
363 #endif // defined(OS_ANDROID) | 361 #endif // defined(OS_ANDROID) |
364 } | 362 } |
365 | 363 |
366 #if defined(OS_ANDROID) | 364 #if defined(OS_ANDROID) |
367 int ChromeBreakpadClient::GetAndroidMinidumpDescriptor() { | 365 int ChromeBreakpadClient::GetAndroidMinidumpDescriptor() { |
368 return kAndroidMinidumpDescriptor; | 366 return kAndroidMinidumpDescriptor; |
369 } | 367 } |
370 #endif | 368 #endif |
371 | 369 |
372 bool ChromeBreakpadClient::EnableBreakpadForProcess( | 370 bool ChromeBreakpadClient::EnableBreakpadForProcess( |
373 const std::string& process_type) { | 371 const std::string& process_type) { |
374 return process_type == switches::kRendererProcess || | 372 return process_type == switches::kRendererProcess || |
375 process_type == switches::kPluginProcess || | 373 process_type == switches::kPluginProcess || |
376 process_type == switches::kPpapiPluginProcess || | 374 process_type == switches::kPpapiPluginProcess || |
377 process_type == switches::kZygoteProcess || | 375 process_type == switches::kZygoteProcess || |
378 process_type == switches::kGpuProcess; | 376 process_type == switches::kGpuProcess; |
379 } | 377 } |
380 | 378 |
381 } // namespace chrome | 379 } // namespace chrome |
OLD | NEW |