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

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

Issue 2538483002: Add management related code to SafeBrowsingNavigationObserverManager (Closed)
Patch Set: rebase-update Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
index fea1e3b7ca7b94cd02d9cc045f4ddb5432a99d57..001c77aff1b2cc44406b79331b1bd9643b7b43d6 100644
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
@@ -137,7 +137,10 @@ void SafeBrowsingNavigationObserver::DidStartNavigation(
content::RenderFrameHost* current_frame_host =
navigation_handle->GetWebContents()->FindFrameByFrameTreeNodeId(
nav_event.frame_id);
- if (current_frame_host &&
+ // For browser initiated navigation (e.g. from address bar or bookmark), we
Charlie Reis 2016/12/09 22:00:24 Sounds right.
Jialiu Lin 2016/12/12 23:43:37 thanks for confirming.
+ // don't fill the source_url to prevent attributing navigation to the last
+ // committed navigation.
+ if (navigation_handle->IsRendererInitiated() && current_frame_host &&
current_frame_host->GetLastCommittedURL().is_valid()) {
nav_event.source_url = SafeBrowsingNavigationObserverManager::ClearEmptyRef(
current_frame_host->GetLastCommittedURL());
@@ -210,17 +213,15 @@ void SafeBrowsingNavigationObserver::DidGetResourceResponseStart(
}
if (!details.url.is_valid() || details.socket_address.IsEmpty())
return;
-
- manager_->RecordHostToIpMapping(details.url.host(),
- details.socket_address.host());
+ if (!details.url.host().empty())
Charlie Reis 2016/12/09 22:00:24 Style nit: Needs braces, since body is more than o
Jialiu Lin 2016/12/12 23:43:37 Thanks for catching this.
+ manager_->RecordHostToIpMapping(details.url.host(),
+ details.socket_address.host());
}
void SafeBrowsingNavigationObserver::DidGetUserInteraction(
const blink::WebInputEvent::Type type) {
last_user_gesture_timestamp_ = base::Time::Now();
has_user_gesture_ = true;
- // TODO (jialiul): Refine user gesture logic when DidOpenRequestedURL
- // covers all retargetting cases.
manager_->RecordUserGestureForWebContents(web_contents(),
last_user_gesture_timestamp_);
}

Powered by Google App Engine
This is Rietveld 408576698