Chromium Code Reviews| 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 |