Commit 94a19c86 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Add EventResult field to SafeBrowsing interstitial events

Bug: 1119390
Change-Id: Id9224cd80ead2d37dc918d8dafd381fa289489e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363836Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799755}
parent 4c403bf0
...@@ -323,11 +323,17 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown( ...@@ -323,11 +323,17 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown(
if (!IsRealtimeReportingEnabled()) if (!IsRealtimeReportingEnabled())
return; return;
PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
auto event_result =
prefs->GetBoolean(prefs::kSafeBrowsingProceedAnywayDisabled)
? safe_browsing::EventResult::BLOCKED
: safe_browsing::EventResult::WARNED;
ReportRealtimeEvent( ReportRealtimeEvent(
kKeyInterstitialEvent, kKeyInterstitialEvent,
base::BindOnce( base::BindOnce(
[](const std::string& url, const std::string& reason, [](const std::string& url, const std::string& reason,
int net_error_code, const std::string& user_name) { int net_error_code, const std::string& user_name,
safe_browsing::EventResult event_result) {
// Convert |params| to a real-time event dictionary and report it. // Convert |params| to a real-time event dictionary and report it.
base::Value event(base::Value::Type::DICTIONARY); base::Value event(base::Value::Type::DICTIONARY);
event.SetStringKey(kKeyUrl, url); event.SetStringKey(kKeyUrl, url);
...@@ -335,9 +341,14 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown( ...@@ -335,9 +341,14 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown(
event.SetIntKey(kKeyNetErrorCode, net_error_code); event.SetIntKey(kKeyNetErrorCode, net_error_code);
event.SetStringKey(kKeyProfileUserName, user_name); event.SetStringKey(kKeyProfileUserName, user_name);
event.SetBoolKey(kKeyClickedThrough, false); event.SetBoolKey(kKeyClickedThrough, false);
event.SetStringKey(
kKeyEventResult,
safe_browsing::EventResultToString(event_result));
return event; return event;
}, },
params.url, params.reason, net_error_code, params.user_name)); params.url, params.reason, net_error_code, params.user_name,
event_result));
} }
void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded( void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded(
...@@ -380,6 +391,9 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded( ...@@ -380,6 +391,9 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded(
event.SetIntKey(kKeyNetErrorCode, net_error_code); event.SetIntKey(kKeyNetErrorCode, net_error_code);
event.SetStringKey(kKeyProfileUserName, user_name); event.SetStringKey(kKeyProfileUserName, user_name);
event.SetBoolKey(kKeyClickedThrough, true); event.SetBoolKey(kKeyClickedThrough, true);
event.SetStringKey(kKeyEventResult,
safe_browsing::EventResultToString(
safe_browsing::EventResult::BYPASSED));
return event; return event;
}, },
params.url, params.reason, net_error_code, params.user_name)); params.url, params.reason, net_error_code, params.user_name));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment