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

Unified Diff: chrome/browser/safe_browsing/download_protection_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/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index e3f41e0a879325c7662ad89acfc4e052b70ae04b..f61f677489e6d9be6b58a9ef3b8e27d590af4dae 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -52,6 +52,7 @@
#include "components/google/core/browser/google_util.h"
#include "components/history/core/browser/history_service.h"
#include "components/prefs/pref_service.h"
+#include "components/safe_browsing_db/safe_browsing_prefs.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/page_navigator.h"
@@ -176,9 +177,8 @@ class DownloadSBClient
total_type_(total_type),
dangerous_type_(dangerous_type) {
Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext());
- is_extended_reporting_ = profile &&
- profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled);
+ is_extended_reporting_ =
+ profile && IsExtendedReportingEnabled(*profile->GetPrefs());
}
virtual void StartCheck() = 0;
@@ -353,9 +353,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
if (item_->GetBrowserContext()) {
Profile* profile =
Profile::FromBrowserContext(item_->GetBrowserContext());
- is_extended_reporting_ = profile &&
- profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled);
+ is_extended_reporting_ =
+ profile && IsExtendedReportingEnabled(*profile->GetPrefs());
is_incognito_ = item_->GetBrowserContext()->IsOffTheRecord();
}
@@ -621,9 +620,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
bool CanReportInvalidArchives() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = Profile::FromBrowserContext(item_->GetBrowserContext());
- if (!profile ||
- !profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled))
+ if (!profile || !IsExtendedReportingEnabled(*profile->GetPrefs()))
return false;
return !item_->GetBrowserContext()->IsOffTheRecord();
@@ -1250,8 +1247,7 @@ class DownloadProtectionService::PPAPIDownloadRequest
GetSupportedFilePath(default_file_path, alternate_extensions)),
weakptr_factory_(this) {
DCHECK(profile);
- is_extended_reporting_ = profile->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingExtendedReportingEnabled);
+ is_extended_reporting_ = IsExtendedReportingEnabled(*profile->GetPrefs());
}
~PPAPIDownloadRequest() override {

Powered by Google App Engine
This is Rietveld 408576698