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

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

Issue 2499313003: Set user_gesture bit at NavigationHandle creation time. (Closed)
Patch Set: rebase Created 4 years 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return delegate_; 136 return delegate_;
137 } 137 }
138 138
139 NavigationController* NavigatorImpl::GetController() { 139 NavigationController* NavigatorImpl::GetController() {
140 return controller_; 140 return controller_;
141 } 141 }
142 142
143 void NavigatorImpl::DidStartProvisionalLoad( 143 void NavigatorImpl::DidStartProvisionalLoad(
144 RenderFrameHostImpl* render_frame_host, 144 RenderFrameHostImpl* render_frame_host,
145 const GURL& url, 145 const GURL& url,
146 const base::TimeTicks& navigation_start) { 146 const base::TimeTicks& navigation_start,
147 NavigationGesture gesture) {
147 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); 148 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame();
148 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 149 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
149 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); 150 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
150 GURL validated_url(url); 151 GURL validated_url(url);
151 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); 152 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
152 render_process_host->FilterURL(false, &validated_url); 153 render_process_host->FilterURL(false, &validated_url);
153 154
154 // Do not allow browser plugin guests to navigate to non-web URLs, since they 155 // Do not allow browser plugin guests to navigate to non-web URLs, since they
155 // cannot swap processes or grant bindings. 156 // cannot swap processes or grant bindings.
156 ChildProcessSecurityPolicyImpl* policy = 157 ChildProcessSecurityPolicyImpl* policy =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 is_renderer_initiated = pending_entry->is_renderer_initiated(); 203 is_renderer_initiated = pending_entry->is_renderer_initiated();
203 pending_nav_entry_id = pending_entry->GetUniqueID(); 204 pending_nav_entry_id = pending_entry->GetUniqueID();
204 started_from_context_menu = pending_entry->has_started_from_context_menu(); 205 started_from_context_menu = pending_entry->has_started_from_context_menu();
205 } 206 }
206 207
207 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( 208 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
208 validated_url, render_frame_host->frame_tree_node(), 209 validated_url, render_frame_host->frame_tree_node(),
209 is_renderer_initiated, 210 is_renderer_initiated,
210 false, // is_same_page 211 false, // is_same_page
211 is_iframe_srcdoc, // is_srcdoc 212 is_iframe_srcdoc, // is_srcdoc
212 navigation_start, pending_nav_entry_id, started_from_context_menu)); 213 navigation_start, pending_nav_entry_id, gesture,
214 started_from_context_menu));
213 } 215 }
214 216
215 void NavigatorImpl::DidFailProvisionalLoadWithError( 217 void NavigatorImpl::DidFailProvisionalLoadWithError(
216 RenderFrameHostImpl* render_frame_host, 218 RenderFrameHostImpl* render_frame_host,
217 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 219 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
218 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() 220 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
219 << ", error_code: " << params.error_code 221 << ", error_code: " << params.error_code
220 << ", error_description: " << params.error_description 222 << ", error_description: " << params.error_description
221 << ", showing_repost_interstitial: " << 223 << ", showing_repost_interstitial: " <<
222 params.showing_repost_interstitial 224 params.showing_repost_interstitial
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 DCHECK(frame_tree_node); 964 DCHECK(frame_tree_node);
963 965
964 NavigationRequest* ongoing_navigation_request = 966 NavigationRequest* ongoing_navigation_request =
965 frame_tree_node->navigation_request(); 967 frame_tree_node->navigation_request();
966 968
967 // The renderer-initiated navigation request is ignored iff a) there is an 969 // The renderer-initiated navigation request is ignored iff a) there is an
968 // ongoing request b) which is browser or user-initiated and c) the renderer 970 // ongoing request b) which is browser or user-initiated and c) the renderer
969 // request is not user-initiated. 971 // request is not user-initiated.
970 if (ongoing_navigation_request && 972 if (ongoing_navigation_request &&
971 (ongoing_navigation_request->browser_initiated() || 973 (ongoing_navigation_request->browser_initiated() ||
972 ongoing_navigation_request->begin_params().has_user_gesture) && 974 ongoing_navigation_request->common_params().gesture ==
973 !begin_params.has_user_gesture) { 975 NavigationGestureUser) &&
976 common_params.gesture != NavigationGestureUser) {
974 RenderFrameHost* current_frame_host = 977 RenderFrameHost* current_frame_host =
975 frame_tree_node->render_manager()->current_frame_host(); 978 frame_tree_node->render_manager()->current_frame_host();
976 current_frame_host->Send( 979 current_frame_host->Send(
977 new FrameMsg_Stop(current_frame_host->GetRoutingID())); 980 new FrameMsg_Stop(current_frame_host->GetRoutingID()));
978 return; 981 return;
979 } 982 }
980 983
981 // In all other cases the current navigation, if any, is canceled and a new 984 // In all other cases the current navigation, if any, is canceled and a new
982 // NavigationRequest is created for the node. 985 // NavigationRequest is created for the node.
983 frame_tree_node->CreatedNavigationRequest( 986 frame_tree_node->CreatedNavigationRequest(
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 if (navigation_handle) 1271 if (navigation_handle)
1269 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1272 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1270 1273
1271 controller_->SetPendingEntry(std::move(entry)); 1274 controller_->SetPendingEntry(std::move(entry));
1272 if (delegate_) 1275 if (delegate_)
1273 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1276 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1274 } 1277 }
1275 } 1278 }
1276 1279
1277 } // namespace content 1280 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/navigator_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698