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

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

Issue 2538483002: Add management related code to SafeBrowsingNavigationObserverManager (Closed)
Patch Set: address nits 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3efb350d843e7954457c40c329b6ebb084f7e972 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
+ // 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,16 @@ 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()) {
+ 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_);
}
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698