Chromium Code Reviews| Index: content/browser/frame_host/navigation_handle_impl.cc |
| diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc |
| index ae9e5dbe57a7670f7f2835d180ace81f6c679869..cbb04ad9e2a06efec23c67ab9d97788f845619ef 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.cc |
| +++ b/content/browser/frame_host/navigation_handle_impl.cc |
| @@ -56,10 +56,12 @@ std::unique_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( |
| bool is_srcdoc, |
| const base::TimeTicks& navigation_start, |
| int pending_nav_entry_id, |
| + NavigationGesture gesture, |
| bool started_from_context_menu) { |
| return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl( |
| url, frame_tree_node, is_renderer_initiated, is_same_page, is_srcdoc, |
| - navigation_start, pending_nav_entry_id, started_from_context_menu)); |
| + navigation_start, pending_nav_entry_id, gesture, |
| + started_from_context_menu)); |
| } |
| NavigationHandleImpl::NavigationHandleImpl( |
| @@ -70,9 +72,10 @@ NavigationHandleImpl::NavigationHandleImpl( |
| bool is_srcdoc, |
| const base::TimeTicks& navigation_start, |
| int pending_nav_entry_id, |
| + NavigationGesture gesture, |
| bool started_from_context_menu) |
| : url_(url), |
| - has_user_gesture_(false), |
| + gesture_(gesture), |
| transition_(ui::PAGE_TRANSITION_LINK), |
| is_external_protocol_(false), |
| net_error_code_(net::OK), |
| @@ -204,9 +207,7 @@ const Referrer& NavigationHandleImpl::GetReferrer() { |
| } |
| bool NavigationHandleImpl::HasUserGesture() { |
| - CHECK_NE(INITIAL, state_) |
| - << "This accessor should not be called before the request is started."; |
| - return has_user_gesture_; |
| + return gesture_ == NavigationGestureUser; |
| } |
| ui::PageTransition NavigationHandleImpl::GetPageTransition() { |
| @@ -302,7 +303,6 @@ NavigationThrottle::ThrottleCheckResult |
| NavigationHandleImpl::CallWillStartRequestForTesting( |
| bool is_post, |
| const Referrer& sanitized_referrer, |
| - bool has_user_gesture, |
| ui::PageTransition transition, |
| bool is_external_protocol) { |
| NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
| @@ -318,7 +318,7 @@ NavigationHandleImpl::CallWillStartRequestForTesting( |
| } |
| WillStartRequest(method, resource_request_body, sanitized_referrer, |
| - has_user_gesture, transition, is_external_protocol, |
| + transition, is_external_protocol, |
| REQUEST_CONTEXT_TYPE_LOCATION, |
| base::Bind(&UpdateThrottleCheckResult, &result)); |
| @@ -417,7 +417,6 @@ void NavigationHandleImpl::WillStartRequest( |
| const std::string& method, |
| scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
| const Referrer& sanitized_referrer, |
| - bool has_user_gesture, |
| ui::PageTransition transition, |
| bool is_external_protocol, |
| RequestContextType request_context_type, |
| @@ -433,7 +432,6 @@ void NavigationHandleImpl::WillStartRequest( |
| if (method_ == "POST") |
| resource_request_body_ = resource_request_body; |
| sanitized_referrer_ = sanitized_referrer; |
| - has_user_gesture_ = has_user_gesture; |
| transition_ = transition; |
| is_external_protocol_ = is_external_protocol; |
| request_context_type_ = request_context_type; |
| @@ -542,9 +540,10 @@ void NavigationHandleImpl::DidCommitNavigation( |
| DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
| DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
| CHECK_EQ(url_, params.url); |
| + // TODO(clamy): DCHECK that params.gesture matches |
|
clamy
2016/11/24 12:20:02
nit: empty line above.
Bryan McQuade
2016/11/28 01:41:03
Done
|
| + // has_user_gesture_. See crbug.com/667572. |
| method_ = params.method; |
| - has_user_gesture_ = (params.gesture == NavigationGestureUser); |
|
clamy
2016/11/24 12:20:02
While we investigate why the gesture doesn't match
Bryan McQuade
2016/11/28 01:41:03
Sure, updated.
|
| transition_ = params.transition; |
| render_frame_host_ = render_frame_host; |