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

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

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 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 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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/process/kill.h" 12 #include "base/process/kill.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/accessibility/accessibility_mode_helper.h" 14 #include "content/browser/accessibility/accessibility_mode_helper.h"
15 #include "content/browser/accessibility/ax_tree_id_registry.h" 15 #include "content/browser/accessibility/ax_tree_id_registry.h"
16 #include "content/browser/accessibility/browser_accessibility_manager.h" 16 #include "content/browser/accessibility/browser_accessibility_manager.h"
17 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 17 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
18 #include "content/browser/bad_message.h" 18 #include "content/browser/bad_message.h"
19 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
20 #include "content/browser/frame_host/cross_process_frame_connector.h" 20 #include "content/browser/frame_host/cross_process_frame_connector.h"
21 #include "content/browser/frame_host/cross_site_transferring_request.h" 21 #include "content/browser/frame_host/cross_site_transferring_request.h"
22 #include "content/browser/frame_host/frame_mojo_shell.h" 22 #include "content/browser/frame_host/frame_mojo_shell.h"
23 #include "content/browser/frame_host/frame_tree.h" 23 #include "content/browser/frame_host/frame_tree.h"
24 #include "content/browser/frame_host/frame_tree_node.h" 24 #include "content/browser/frame_host/frame_tree_node.h"
25 #include "content/browser/frame_host/navigation_handle_factory.h"
25 #include "content/browser/frame_host/navigation_handle_impl.h" 26 #include "content/browser/frame_host/navigation_handle_impl.h"
26 #include "content/browser/frame_host/navigation_request.h" 27 #include "content/browser/frame_host/navigation_request.h"
27 #include "content/browser/frame_host/navigator.h" 28 #include "content/browser/frame_host/navigator.h"
28 #include "content/browser/frame_host/navigator_impl.h" 29 #include "content/browser/frame_host/navigator_impl.h"
29 #include "content/browser/frame_host/render_frame_host_delegate.h" 30 #include "content/browser/frame_host/render_frame_host_delegate.h"
30 #include "content/browser/frame_host/render_frame_proxy_host.h" 31 #include "content/browser/frame_host/render_frame_proxy_host.h"
31 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 32 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
32 #include "content/browser/geolocation/geolocation_service_context.h" 33 #include "content/browser/geolocation/geolocation_service_context.h"
33 #include "content/browser/permissions/permission_service_context.h" 34 #include "content/browser/permissions/permission_service_context.h"
34 #include "content/browser/permissions/permission_service_impl.h" 35 #include "content/browser/permissions/permission_service_impl.h"
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 // navigation. 901 // navigation.
901 if (navigation_handle_ && 902 if (navigation_handle_ &&
902 navigation_handle_->GetURL() != validated_params.url) { 903 navigation_handle_->GetURL() != validated_params.url) {
903 navigation_handle_.reset(); 904 navigation_handle_.reset();
904 } 905 }
905 906
906 // Synchronous renderer-initiated navigations will send a 907 // Synchronous renderer-initiated navigations will send a
907 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad 908 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad
908 // message. 909 // message.
909 if (!navigation_handle_) { 910 if (!navigation_handle_) {
910 navigation_handle_ = NavigationHandleImpl::Create( 911 navigation_handle_ = NavigationHandleFactory::Create(
911 validated_params.url, frame_tree_node_->IsMainFrame(), 912 validated_params.url, frame_tree_node_->IsMainFrame(),
912 frame_tree_node_->navigator()->GetDelegate()); 913 frame_tree_node_->navigator()->GetDelegate());
913 } 914 }
914 915
915 accessibility_reset_count_ = 0; 916 accessibility_reset_count_ = 0;
916 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 917 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
917 918
918 // For a top-level frame, there are potential security concerns associated 919 // For a top-level frame, there are potential security concerns associated
919 // with displaying graphics from a previously loaded page after the URL in 920 // with displaying graphics from a previously loaded page after the URL in
920 // the omnibar has been changed. It is unappealing to clear the page 921 // the omnibar has been changed. It is unappealing to clear the page
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 // mirroring works correctly, add a check here to enforce it. 1352 // mirroring works correctly, add a check here to enforce it.
1352 delegate_->UpdateEncoding(this, encoding_name); 1353 delegate_->UpdateEncoding(this, encoding_name);
1353 } 1354 }
1354 1355
1355 void RenderFrameHostImpl::OnBeginNavigation( 1356 void RenderFrameHostImpl::OnBeginNavigation(
1356 const CommonNavigationParams& common_params, 1357 const CommonNavigationParams& common_params,
1357 const BeginNavigationParams& begin_params, 1358 const BeginNavigationParams& begin_params,
1358 scoped_refptr<ResourceRequestBody> body) { 1359 scoped_refptr<ResourceRequestBody> body) {
1359 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 1360 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
1360 switches::kEnableBrowserSideNavigation)); 1361 switches::kEnableBrowserSideNavigation));
1362 // Filter the url.
nasko 2015/09/16 20:33:39 nit: a redundant comment.
clamy 2015/09/17 01:18:33 Done.
1363 CommonNavigationParams validated_params = common_params;
1364 GetProcess()->FilterURL(false, &validated_params.url);
1361 frame_tree_node()->navigator()->OnBeginNavigation( 1365 frame_tree_node()->navigator()->OnBeginNavigation(
1362 frame_tree_node(), common_params, begin_params, body); 1366 frame_tree_node(), validated_params, begin_params, body);
1363 } 1367 }
1364 1368
1365 void RenderFrameHostImpl::OnDispatchLoad() { 1369 void RenderFrameHostImpl::OnDispatchLoad() {
1366 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 1370 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
1367 // Only frames with an out-of-process parent frame should be sending this 1371 // Only frames with an out-of-process parent frame should be sending this
1368 // message. 1372 // message.
1369 RenderFrameProxyHost* proxy = 1373 RenderFrameProxyHost* proxy =
1370 frame_tree_node()->render_manager()->GetProxyToParent(); 1374 frame_tree_node()->render_manager()->GetProxyToParent();
1371 if (!proxy) { 1375 if (!proxy) {
1372 bad_message::ReceivedBadMessage(GetProcess(), 1376 bad_message::ReceivedBadMessage(GetProcess(),
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 BrowserPluginInstanceIDToAXTreeID(value))); 2245 BrowserPluginInstanceIDToAXTreeID(value)));
2242 break; 2246 break;
2243 case AX_CONTENT_INT_ATTRIBUTE_LAST: 2247 case AX_CONTENT_INT_ATTRIBUTE_LAST:
2244 NOTREACHED(); 2248 NOTREACHED();
2245 break; 2249 break;
2246 } 2250 }
2247 } 2251 }
2248 } 2252 }
2249 2253
2250 } // namespace content 2254 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698