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

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

Issue 1414343007: Collect threat details for phishing and UwS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 1 month 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 b684fabea0ff6bc0d2cd50804f7975141f408a91..176e712b3b0f58a8da4577c0aecdb60bbf14669b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -193,20 +193,29 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
navigation_entry_index_to_remove_ = -1;
}
- // Start computing malware details. They will be sent only
+ // Start computing threat details. They will be sent only
// if the user opts-in on the blocking page later.
// If there's more than one malicious resources, it means the user
// clicked through the first warning, so we don't prepare additional
// reports.
if (unsafe_resources.size() == 1 &&
- unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE &&
- threat_details_.get() == NULL && CanShowMalwareDetailsOption()) {
+ ShouldReportThreatDetails(unsafe_resources[0].threat_type) &&
+ threat_details_.get() == NULL && CanShowThreatDetailsOption()) {
threat_details_ = ThreatDetails::NewThreatDetails(ui_manager_, web_contents,
unsafe_resources[0]);
}
}
-bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() {
+bool SafeBrowsingBlockingPage::ShouldReportThreatDetails(
+ SBThreatType threat_type) {
+ return threat_type == SB_THREAT_TYPE_URL_PHISHING ||
+ threat_type == SB_THREAT_TYPE_URL_MALWARE ||
+ threat_type == SB_THREAT_TYPE_URL_UNWANTED ||
+ threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL ||
+ threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL;
+}
+
+bool SafeBrowsingBlockingPage::CanShowThreatDetailsOption() {
return (!web_contents()->GetBrowserContext()->IsOffTheRecord() &&
web_contents()->GetURL().SchemeIs(url::kHttpScheme) &&
IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingOptInAllowed));
@@ -348,7 +357,7 @@ void SafeBrowsingBlockingPage::OverrideRendererPrefs(
void SafeBrowsingBlockingPage::OnProceed() {
proceeded_ = true;
- // Send the malware details, if we opted to.
+ // Send the threat details, if we opted to.
FinishThreatDetails(malware_details_proceed_delay_ms_, true, /* did_proceed */
metrics_helper()->NumVisits());
@@ -429,8 +438,7 @@ void SafeBrowsingBlockingPage::FinishThreatDetails(int64 delay_ms,
bool did_proceed,
int num_visits) {
if (threat_details_.get() == NULL)
- return; // Not all interstitials have malware details (eg phishing).
- DCHECK_EQ(interstitial_reason_, SB_REASON_MALWARE);
+ return; // Not all interstitials have threat details (eg., incognito mode).
const bool enabled =
IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled) &&
@@ -616,7 +624,7 @@ void SafeBrowsingBlockingPage::PopulateInterstitialStrings(
void SafeBrowsingBlockingPage::PopulateExtendedReportingOption(
base::DictionaryValue* load_time_data) {
// Only show checkbox if !(HTTPS || incognito-mode).
- const bool show = CanShowMalwareDetailsOption();
+ const bool show = CanShowThreatDetailsOption();
load_time_data->SetBoolean(interstitials::kDisplayCheckBox, show);
if (!show)
return;

Powered by Google App Engine
This is Rietveld 408576698