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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 2499313003: Set user_gesture bit at NavigationHandle creation time. (Closed)
Patch Set: comments Created 4 years, 1 month 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: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 5740af67acbee9231ed9620e601cc8be1848aa9a..1295eda0ca1a219c7da1fb7d03f5d23b777b1b84 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -143,7 +143,8 @@ NavigationController* NavigatorImpl::GetController() {
void NavigatorImpl::DidStartProvisionalLoad(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
- const base::TimeTicks& navigation_start) {
+ const base::TimeTicks& navigation_start,
+ bool has_user_gesture) {
bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame();
bool is_error_page = (url.spec() == kUnreachableWebDataURL);
bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
@@ -209,7 +210,8 @@ void NavigatorImpl::DidStartProvisionalLoad(
is_renderer_initiated,
false, // is_same_page
is_iframe_srcdoc, // is_srcdoc
- navigation_start, pending_nav_entry_id, started_from_context_menu));
+ navigation_start, pending_nav_entry_id, has_user_gesture,
+ started_from_context_menu));
}
void NavigatorImpl::DidFailProvisionalLoadWithError(
@@ -1001,7 +1003,8 @@ void NavigatorImpl::OnBeginNavigation(
// entry from the NavigationController.
NavigationEntry* pending_entry = controller_->GetPendingEntry();
navigation_request->CreateNavigationHandle(
- pending_entry ? pending_entry->GetUniqueID() : 0);
+ pending_entry ? pending_entry->GetUniqueID() : 0,
+ begin_params.has_user_gesture);
navigation_request->BeginNavigation();
}
@@ -1158,7 +1161,13 @@ void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node,
}
frame_tree_node->CreatedNavigationRequest(std::move(scoped_request));
- navigation_request->CreateNavigationHandle(entry.GetUniqueID());
+
+ // Browser-initiated navigations are not currently considered to have a user
+ // gesture, though this is intended to change as part of PlzNavigate (see the
+ // TODO(clamy) for HasUserGesture in navigation_handle.h).
+ bool has_user_gesture = false;
+ navigation_request->CreateNavigationHandle(entry.GetUniqueID(),
+ has_user_gesture);
clamy 2016/11/17 14:30:04 We have the info about user gesture in the BeginNa
Bryan McQuade 2016/11/19 20:21:38 Ah, I missed that. Fixed, thanks!
// Have the current renderer execute its beforeunload event if needed. If it
// is not needed then NavigationRequest::BeginNavigation should be directly

Powered by Google App Engine
This is Rietveld 408576698