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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 2378393002: Pass the user_gesture context in the IPC message FrameMsg_CommitNavigation to the renderer. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1033
1034 // Navigation to a javascript URL is not a "real" navigation so there is no 1034 // Navigation to a javascript URL is not a "real" navigation so there is no
1035 // need to create a NavigationHandle. The navigation commits immediately and 1035 // need to create a NavigationHandle. The navigation commits immediately and
1036 // the NavigationRequest is not assigned to the FrameTreeNode as navigating to 1036 // the NavigationRequest is not assigned to the FrameTreeNode as navigating to
1037 // a Javascript URL should not interrupt a previous navigation. 1037 // a Javascript URL should not interrupt a previous navigation.
1038 // Note: The scoped_request will be destroyed at the end of this function. 1038 // Note: The scoped_request will be destroyed at the end of this function.
1039 if (dest_url.SchemeIs(url::kJavaScriptScheme)) { 1039 if (dest_url.SchemeIs(url::kJavaScriptScheme)) {
1040 RenderFrameHostImpl* render_frame_host = 1040 RenderFrameHostImpl* render_frame_host =
1041 frame_tree_node->render_manager()->GetFrameHostForNavigation( 1041 frame_tree_node->render_manager()->GetFrameHostForNavigation(
1042 *navigation_request); 1042 *navigation_request);
1043 render_frame_host->CommitNavigation(nullptr, // response 1043 render_frame_host->CommitNavigation(
1044 nullptr, // body 1044 nullptr, // response
1045 navigation_request->common_params(), 1045 nullptr, // body
1046 navigation_request->request_params(), 1046 navigation_request->common_params(),
1047 navigation_request->is_view_source()); 1047 navigation_request->request_params(),
1048 navigation_request->is_view_source(),
1049 navigation_request->begin_params().has_user_gesture);
1048 return; 1050 return;
1049 } 1051 }
1050 1052
1051 frame_tree_node->CreatedNavigationRequest(std::move(scoped_request)); 1053 frame_tree_node->CreatedNavigationRequest(std::move(scoped_request));
1052 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); 1054 navigation_request->CreateNavigationHandle(entry.GetUniqueID());
1053 1055
1054 // Have the current renderer execute its beforeunload event if needed. If it 1056 // Have the current renderer execute its beforeunload event if needed. If it
1055 // is not needed (when beforeunload dispatch is not needed or this navigation 1057 // is not needed (when beforeunload dispatch is not needed or this navigation
1056 // is synchronous and same-site) then NavigationRequest::BeginNavigation 1058 // is synchronous and same-site) then NavigationRequest::BeginNavigation
1057 // should be directly called instead. 1059 // should be directly called instead.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 if (pending_entry != controller_->GetVisibleEntry() || 1201 if (pending_entry != controller_->GetVisibleEntry() ||
1200 !should_preserve_entry) { 1202 !should_preserve_entry) {
1201 controller_->DiscardPendingEntry(true); 1203 controller_->DiscardPendingEntry(true);
1202 1204
1203 // Also force the UI to refresh. 1205 // Also force the UI to refresh.
1204 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1206 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1205 } 1207 }
1206 } 1208 }
1207 1209
1208 } // namespace content 1210 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698