Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3306)

Unified Diff: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc

Issue 2418813002: [Reland] Refactoring of SBER preference usage (Closed)
Patch Set: Sync Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
index f6a647b5337706235da20fd4bef04ae6fe369993..476079478343bc7b9835905dda4453c46c51a7ae 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
@@ -39,6 +39,7 @@
#include "chrome/common/safe_browsing/csd.pb.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing_db/safe_browsing_prefs.h"
#include "components/user_prefs/tracked/tracked_preference_validation_delegate.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
@@ -135,8 +136,7 @@ bool ProfileCanAcceptIncident(Profile* profile, const Incident& incident) {
case MinimumProfileConsent::SAFE_BROWSING_ENABLED:
return true;
case MinimumProfileConsent::SAFE_BROWSING_EXTENDED_REPORTING_ENABLED:
- return profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled);
+ return IsExtendedReportingEnabled(*profile->GetPrefs());
}
NOTREACHED();
return false;
@@ -328,8 +328,7 @@ bool IncidentReportingService::IsEnabledForProfile(Profile* profile) {
return false;
if (IsFieldTrialEnabled())
return true;
- return profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled);
+ return IsExtendedReportingEnabled(*profile->GetPrefs());
}
IncidentReportingService::IncidentReportingService(
@@ -441,9 +440,7 @@ void IncidentReportingService::
// extended reporting. If none are now, running will commence if/when such a
// profile is added.
Profile* profile = FindEligibleProfile();
- if (profile &&
- profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled)) {
+ if (profile && IsExtendedReportingEnabled(*profile->GetPrefs())) {
extended_reporting_only_delayed_analysis_callbacks_.Start();
}
}
@@ -533,8 +530,7 @@ void IncidentReportingService::OnProfileAdded(Profile* profile) {
// if they're already running.
delayed_analysis_callbacks_.Start();
- if (profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled)) {
+ if (IsExtendedReportingEnabled(*profile->GetPrefs())) {
extended_reporting_only_delayed_analysis_callbacks_.Start();
}
@@ -640,8 +636,7 @@ Profile* IncidentReportingService::FindEligibleProfile() const {
continue;
// If the current profile has Extended Reporting enabled, stop looking and
// use that one.
- if (scan->first->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled)) {
+ if (IsExtendedReportingEnabled(*scan->first->GetPrefs())) {
return scan->first;
}
// Otherwise, store this one as a candidate and keep looking (in case we
@@ -914,9 +909,8 @@ void IncidentReportingService::ProcessIncidentsIfCollectionComplete() {
// Find the profile that benefits from the strongest protections.
Profile* eligible_profile = FindEligibleProfile();
process->set_extended_consent(
- eligible_profile ? eligible_profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled) :
- false);
+ eligible_profile &&
+ IsExtendedReportingEnabled(*eligible_profile->GetPrefs()));
process->set_field_trial_participant(enabled_by_field_trial_);

Powered by Google App Engine
This is Rietveld 408576698