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

Side by Side Diff: chrome/browser/ssl/cert_report_helper.cc

Issue 1467063002: Introduce the ChromeControllerClient class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bugfix Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/ssl/cert_report_helper.h" 5 #include "chrome/browser/ssl/cert_report_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ssl/ssl_cert_reporter.h" 15 #include "chrome/browser/ssl/ssl_cert_reporter.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "components/security_interstitials/core/controller_client.h"
18 #include "components/security_interstitials/core/metrics_helper.h" 19 #include "components/security_interstitials/core/metrics_helper.h"
19 #include "components/variations/variations_associated_data.h" 20 #include "components/variations/variations_associated_data.h"
20 #include "content/public/browser/browser_context.h" 21 #include "content/public/browser/browser_context.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 24
24 // Constants for the HTTPSErrorReporter Finch experiment 25 // Constants for the HTTPSErrorReporter Finch experiment
25 const char CertReportHelper::kFinchExperimentName[] = "ReportCertificateErrors"; 26 const char CertReportHelper::kFinchExperimentName[] = "ReportCertificateErrors";
26 const char CertReportHelper::kFinchGroupShowPossiblySend[] = 27 const char CertReportHelper::kFinchGroupShowPossiblySend[] =
27 "ShowAndPossiblySend"; 28 "ShowAndPossiblySend";
(...skipping 20 matching lines...) Expand all
48 CertReportHelper::~CertReportHelper() { 49 CertReportHelper::~CertReportHelper() {
49 } 50 }
50 51
51 void CertReportHelper::PopulateExtendedReportingOption( 52 void CertReportHelper::PopulateExtendedReportingOption(
52 base::DictionaryValue* load_time_data) { 53 base::DictionaryValue* load_time_data) {
53 // Only show the checkbox if not off-the-record and if this client is 54 // Only show the checkbox if not off-the-record and if this client is
54 // part of the respective Finch group, and the feature is not disabled 55 // part of the respective Finch group, and the feature is not disabled
55 // by policy. 56 // by policy.
56 const bool show = ShouldShowCertificateReporterCheckbox(); 57 const bool show = ShouldShowCertificateReporterCheckbox();
57 58
58 load_time_data->SetBoolean(interstitials::kDisplayCheckBox, show); 59 load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox, show);
59 if (!show) 60 if (!show)
60 return; 61 return;
61 62
62 load_time_data->SetBoolean( 63 load_time_data->SetBoolean(
63 interstitials::kBoxChecked, 64 security_interstitials::kBoxChecked,
64 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled)); 65 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled));
65 66
66 const std::string privacy_link = base::StringPrintf( 67 const std::string privacy_link = base::StringPrintf(
67 interstitials::kPrivacyLinkHtml, 68 security_interstitials::kPrivacyLinkHtml,
68 SecurityInterstitialPage::CMD_OPEN_REPORTING_PRIVACY, 69 security_interstitials::CMD_OPEN_REPORTING_PRIVACY,
69 l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE).c_str()); 70 l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE).c_str());
70 71
71 load_time_data->SetString( 72 load_time_data->SetString(
72 interstitials::kOptInLink, 73 security_interstitials::kOptInLink,
73 l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, 74 l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE,
74 base::UTF8ToUTF16(privacy_link))); 75 base::UTF8ToUTF16(privacy_link)));
75 } 76 }
76 77
77 void CertReportHelper::FinishCertCollection( 78 void CertReportHelper::FinishCertCollection(
78 certificate_reporting::ErrorReport::ProceedDecision user_proceeded) { 79 certificate_reporting::ErrorReport::ProceedDecision user_proceeded) {
79 if (!ShouldShowCertificateReporterCheckbox()) 80 if (!ShouldShowCertificateReporterCheckbox())
80 return; 81 return;
81 82
82 if (!IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled)) 83 if (!IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled))
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 145 }
145 #endif 146 #endif
146 return false; 147 return false;
147 } 148 }
148 149
149 bool CertReportHelper::IsPrefEnabled(const char* pref) { 150 bool CertReportHelper::IsPrefEnabled(const char* pref) {
150 Profile* profile = 151 Profile* profile =
151 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 152 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
152 return profile->GetPrefs()->GetBoolean(pref); 153 return profile->GetPrefs()->GetBoolean(pref);
153 } 154 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/captive_portal_blocking_page.cc ('k') | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698