Index: chrome/browser/ssl/cert_report_helper.cc |
diff --git a/chrome/browser/ssl/cert_report_helper.cc b/chrome/browser/ssl/cert_report_helper.cc |
index 08d57718d0d0a570c59821b8a5b6968204f20931..092984b0e92b14a2a7e60ed211875022d5e462fb 100644 |
--- a/chrome/browser/ssl/cert_report_helper.cc |
+++ b/chrome/browser/ssl/cert_report_helper.cc |
@@ -18,6 +18,7 @@ |
#include "chrome/common/pref_names.h" |
#include "chrome/grit/generated_resources.h" |
#include "components/prefs/pref_service.h" |
+#include "components/safe_browsing_db/safe_browsing_prefs.h" |
#include "components/security_interstitials/core/controller_client.h" |
#include "components/security_interstitials/core/metrics_helper.h" |
#include "components/variations/variations_associated_data.h" |
@@ -25,6 +26,15 @@ |
#include "content/public/browser/web_contents.h" |
#include "ui/base/l10n/l10n_util.h" |
+namespace { |
+ |
+// Returns a pointer to the Profile associated with |web_contents|. |
+Profile* GetProfile(content::WebContents* web_contents) { |
+ return Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
+} |
+ |
+} // namespace |
+ |
// Constants for the HTTPSErrorReporter Finch experiment |
const char CertReportHelper::kFinchExperimentName[] = "ReportCertificateErrors"; |
const char CertReportHelper::kFinchGroupShowPossiblySend[] = |
@@ -63,9 +73,9 @@ void CertReportHelper::PopulateExtendedReportingOption( |
if (!show) |
return; |
- load_time_data->SetBoolean( |
- security_interstitials::kBoxChecked, |
- IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled)); |
+ load_time_data->SetBoolean(security_interstitials::kBoxChecked, |
+ safe_browsing::IsExtendedReportingEnabled( |
+ *GetProfile(web_contents_)->GetPrefs())); |
const std::string privacy_link = base::StringPrintf( |
security_interstitials::kPrivacyLinkHtml, |
@@ -83,7 +93,8 @@ void CertReportHelper::FinishCertCollection( |
if (!ShouldShowCertificateReporterCheckbox()) |
return; |
- if (!IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled)) |
+ if (!safe_browsing::IsExtendedReportingEnabled( |
+ *GetProfile(web_contents_)->GetPrefs())) |
return; |
if (metrics_helper_) { |
@@ -145,7 +156,5 @@ bool CertReportHelper::ShouldReportCertificateError() { |
} |
bool CertReportHelper::IsPrefEnabled(const char* pref) { |
- Profile* profile = |
- Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
- return profile->GetPrefs()->GetBoolean(pref); |
+ return GetProfile(web_contents_)->GetPrefs()->GetBoolean(pref); |
} |