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

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

Issue 2578363002: Wire up download attribution enable finch experiment (Closed)
Patch Set: Re-enable SingleMetaRefreshRedirectTargetBlank on linux 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 3efb350d843e7954457c40c329b6ebb084f7e972..eec6206684cf9f7536011126830e9ed5a82a768a 100644
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
@@ -70,13 +70,14 @@ NavigationEvent::~NavigationEvent() {}
// SafeBrowsingNavigationObserver --------------------------------------------
// static
-void SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
- content::WebContents* web_contents) {
- if (FromWebContents(web_contents))
- return;
- // TODO(jialiul): This method will be called by TabHelpers::AttachTabHelpers.
- // Complete this method when the entire class is ready.
- NOTIMPLEMENTED();
+void SafeBrowsingNavigationObserver::CreateForWebContents(
+ content::WebContents* web_contents,
+ const scoped_refptr<SafeBrowsingNavigationObserverManager>& manager) {
+ if (!FromWebContents(web_contents)) {
+ web_contents->SetUserData(
+ kWebContentsUserDataKey,
+ new SafeBrowsingNavigationObserver(web_contents, manager));
+ }
}
// static
@@ -115,11 +116,13 @@ void SafeBrowsingNavigationObserver::DidStartNavigation(
!SafeBrowsingNavigationObserverManager::IsUserGestureExpired(
last_user_gesture_timestamp_)) ||
!navigation_handle->IsRendererInitiated()) {
- nav_event.is_user_initiated = has_user_gesture_;
- manager_->OnUserGestureConsumed(web_contents(),
- last_user_gesture_timestamp_);
+ nav_event.is_user_initiated = true;
+ if (has_user_gesture_) {
+ manager_->OnUserGestureConsumed(web_contents(),
+ last_user_gesture_timestamp_);
+ has_user_gesture_ = false;
Nathan Parker 2016/12/20 01:01:33 So this consumes the user gesture only if there re
Jialiu Lin 2016/12/20 02:07:51 Yes. That's correct.
+ }
}
- has_user_gesture_ = false;
}
// All the other fields are reconstructed based on current content of

Powered by Google App Engine
This is Rietveld 408576698