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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2378393002: Pass the user_gesture context in the IPC message FrameMsg_CommitNavigation to the renderer. (Closed)
Patch Set: Created 4 years, 3 months 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/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 0483c3d0781c3c8393f1c3d29009769c38df48bd..24fafd9677c7276347a0184ad8d35278aed818e8 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4859,7 +4859,8 @@ void RenderFrameImpl::OnCommitNavigation(
const ResourceResponseHead& response,
const GURL& stream_url,
const CommonNavigationParams& common_params,
- const RequestNavigationParams& request_params) {
+ const RequestNavigationParams& request_params,
+ bool user_gesture) {
CHECK(IsBrowserSideNavigationEnabled());
// This will override the url requested by the WebURLLoader, as well as
// provide it with the response to the request.
@@ -4868,6 +4869,11 @@ void RenderFrameImpl::OnCommitNavigation(
stream_override->stream_url = stream_url;
stream_override->response = response;
+ // If the request was initiated in the context of a user gesture then make
+ // sure that the navigation also executes in the context of a user gesture.
+ std::unique_ptr<blink::WebScopedUserGesture> gesture(
+ user_gesture ? new blink::WebScopedUserGesture : nullptr);
+
NavigateInternal(common_params, StartNavigationParams(), request_params,
std::move(stream_override));
}

Powered by Google App Engine
This is Rietveld 408576698