Commit 04bbedf0 authored by Ian Barkley-Yeung's avatar Ian Barkley-Yeung Committed by Commit Bot

Ignore crashpad's upload consent on ChromeOS

ChromeOS already has an OS-level consent system governing creation and
uploading of crash reports. Remove the separate crashpad one.

FYI, crashpad's upload consent was already being ignored. This is just
ensuring that fact is clear.

BUG=chromium:1037656
TEST=Ran on Linux with --enable-crashpad, could enable and disable crash
uploading. Ran on ChromeOS with --enable-crashpad, crash reports still
generated.

Change-Id: I1a8bbafb3292009fdb02ecc84dd1506535766e61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2044641
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742788}
parent 7da5ee64
......@@ -24,7 +24,9 @@
#include "media/audio/audio_manager.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
#include "chrome/installer/util/google_update_settings.h"
#else
#include "base/command_line.h"
#include "base/linux_util.h"
#include "chrome/common/chrome_paths_internal.h"
......@@ -81,10 +83,23 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() {
void ChromeBrowserMainPartsLinux::PostProfileInit() {
ChromeBrowserMainPartsPosix::PostProfileInit();
bool enabled = (crash_reporter::IsCrashpadEnabled() &&
crash_reporter::GetUploadsEnabled()) ||
breakpad::IsCrashReporterEnabled();
g_browser_process->metrics_service()->RecordBreakpadRegistration(enabled);
bool breakpad_registered;
if (crash_reporter::IsCrashpadEnabled()) {
// If we're using crashpad, there's no breakpad and crashpad is always
// registered as a crash handler. Since setting |breakpad_registered| to
// true all the time isn't useful, we overload the meaning of the breakpad
// registration metric to mean "is crash reporting enabled", since that's
// what breakpad registration effectively meant in the days before crashpad.
#if defined(OS_CHROMEOS)
breakpad_registered = GoogleUpdateSettings::GetCollectStatsConsent();
#else
breakpad_registered = crash_reporter::GetUploadsEnabled();
#endif
} else {
breakpad_registered = breakpad::IsCrashReporterEnabled();
}
g_browser_process->metrics_service()->RecordBreakpadRegistration(
breakpad_registered);
}
void ChromeBrowserMainPartsLinux::PostMainMessageLoopStart() {
......
......@@ -1212,7 +1212,6 @@ void WizardController::OnChangedMetricsReportingState(bool enabled) {
StatsReportingController::Get()->SetEnabled(
ProfileManager::GetActiveUserProfile(), enabled);
if (crash_reporter::IsCrashpadEnabled()) {
crash_reporter::SetUploadConsent(enabled);
return;
}
......
......@@ -77,7 +77,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
#if defined(OS_MACOSX)
crash_reporter::SetUploadConsent(consented);
#elif defined(OS_LINUX)
#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
if (crash_reporter::IsCrashpadEnabled()) {
crash_reporter::SetUploadConsent(consented);
}
......
......@@ -109,7 +109,6 @@ void InitializeCrashpadImpl(bool initial_client,
initialized = true;
const bool browser_process = process_type.empty();
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
if (initial_client) {
#if defined(OS_MACOSX)
......@@ -201,7 +200,10 @@ void InitializeCrashpadImpl(bool initial_client,
g_database =
crashpad::CrashReportDatabase::Initialize(database_path).release();
#if !defined(OS_CHROMEOS)
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
SetUploadConsent(crash_reporter_client->GetCollectStatsConsent());
#endif
}
}
......@@ -238,6 +240,7 @@ crashpad::CrashpadClient& GetCrashpadClient() {
return *client;
}
#if !defined(OS_CHROMEOS)
void SetUploadConsent(bool consent) {
if (!g_database)
return;
......@@ -269,6 +272,7 @@ bool GetUploadsEnabled() {
return false;
}
#endif // !defined(OS_CHROMEOS)
#if !defined(OS_ANDROID)
void DumpWithoutCrashing() {
......
......@@ -105,6 +105,10 @@ void InitializeCrashpadWithDllEmbeddedHandler(
// it does not already exist. This is called as part of InitializeCrashpad.
crashpad::CrashpadClient& GetCrashpadClient();
// ChromeOS has its own, OS-level consent system; Chrome does not maintain a
// separate Upload Consent on ChromeOS.
#if !defined(OS_CHROMEOS)
// Enables or disables crash report upload, taking the given consent to upload
// into account. Consent may be ignored, uploads may not be enabled even with
// consent, but will only be enabled without consent when policy enforces crash
......@@ -118,6 +122,7 @@ void SetUploadConsent(bool consent);
// Determines whether uploads are enabled or disabled. This information is only
// available in the browser process.
bool GetUploadsEnabled();
#endif // !defined(OS_CHROMEOS)
enum class ReportUploadState {
NotUploaded,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment