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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment typo Created 5 years, 9 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/safe_browsing_blocking_page.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index 1fe998e56aa5859ecd2669fa1eb232a42db569e3..31c19863d79d034acb88da00f6089f9d8a875133 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -68,20 +68,12 @@ const char kLearnMoreMalwareUrlV2[] =
const char kLearnMorePhishingUrlV2[] =
"https://www.google.com/transparencyreport/safebrowsing/";
-const char kPrivacyLinkHtml[] =
- "<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand(%d); "
- "return false;\" onmousedown=\"return false;\">%s</a>";
-
// After a malware interstitial where the user opted-in to the report
// but clicked "proceed anyway", we delay the call to
// MalwareDetails::FinishCollection() by this much time (in
// milliseconds).
const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000;
-// Other constants used to communicate with the JavaScript.
-const char kBoxChecked[] = "boxchecked";
-const char kDisplayCheckBox[] = "displaycheckbox";
-
// Constants for the Experience Sampling instrumentation.
const char kEventNameMalware[] = "safebrowsing_interstitial_";
const char kEventNameHarmful[] = "harmful_interstitial_";
@@ -250,16 +242,7 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& page_cmd) {
// User pressed on the SB Extended Reporting "privacy policy" link.
metrics_helper_->RecordUserInteraction(
SecurityInterstitialMetricsHelper::SHOW_PRIVACY_POLICY);
- GURL privacy_url(
- l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL));
- privacy_url = google_util::AppendGoogleLocaleParam(
- privacy_url, g_browser_process->GetApplicationLocale());
- OpenURLParams params(privacy_url,
- Referrer(),
- CURRENT_TAB,
- ui::PAGE_TRANSITION_LINK,
- false);
- web_contents()->OpenURL(params);
+ OpenExtendedReportingPrivacyPolicy();
break;
}
case CMD_PROCEED: {
@@ -339,14 +322,6 @@ void SafeBrowsingBlockingPage::OverrideRendererPrefs(
prefs, profile, web_contents());
}
-void SafeBrowsingBlockingPage::SetReportingPreference(bool report) {
- Profile* profile = Profile::FromBrowserContext(
- web_contents()->GetBrowserContext());
- PrefService* pref = profile->GetPrefs();
- pref->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, report);
- UMA_HISTOGRAM_BOOLEAN("SB2.SetExtendedReportingEnabled", report);
-}
-
void SafeBrowsingBlockingPage::OnProceed() {
proceeded_ = true;
// Send the malware details, if we opted to.
@@ -441,12 +416,6 @@ void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
}
}
-bool SafeBrowsingBlockingPage::IsPrefEnabled(const char* pref) {
- Profile* profile =
- Profile::FromBrowserContext(web_contents()->GetBrowserContext());
- return profile->GetPrefs()->GetBoolean(pref);
-}
-
// static
void SafeBrowsingBlockingPage::NotifySafeBrowsingUIManager(
SafeBrowsingUIManager* ui_manager,
@@ -588,21 +557,19 @@ void SafeBrowsingBlockingPage::PopulateExtendedReportingOption(
base::DictionaryValue* load_time_data) {
// Only show checkbox if !(HTTPS || incognito-mode).
const bool show = CanShowMalwareDetailsOption();
- load_time_data->SetBoolean(kDisplayCheckBox, show);
+ load_time_data->SetBoolean(interstitials::kDisplayCheckBox, show);
if (!show)
return;
const std::string privacy_link = base::StringPrintf(
- kPrivacyLinkHtml,
- CMD_OPEN_REPORTING_PRIVACY,
- l10n_util::GetStringUTF8(
- IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE).c_str());
+ interstitials::kPrivacyLinkHtml, CMD_OPEN_REPORTING_PRIVACY,
+ l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE).c_str());
load_time_data->SetString(
- "optInLink",
+ interstitials::kOptInLink,
l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE,
base::UTF8ToUTF16(privacy_link)));
load_time_data->SetBoolean(
- kBoxChecked,
+ interstitials::kBoxChecked,
IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled));
}

Powered by Google App Engine
This is Rietveld 408576698