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

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

Issue 789643005: PlzNavigate: make content unit tests work with browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancel-navigations
Patch Set: Created 5 years, 11 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/metrics/user_metrics_action.h" 12 #include "base/metrics/user_metrics_action.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/browser_accessibility_manager.h" 15 #include "content/browser/accessibility/browser_accessibility_manager.h"
16 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 16 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
17 #include "content/browser/child_process_security_policy_impl.h" 17 #include "content/browser/child_process_security_policy_impl.h"
18 #include "content/browser/frame_host/cross_process_frame_connector.h" 18 #include "content/browser/frame_host/cross_process_frame_connector.h"
19 #include "content/browser/frame_host/cross_site_transferring_request.h" 19 #include "content/browser/frame_host/cross_site_transferring_request.h"
20 #include "content/browser/frame_host/frame_accessibility.h" 20 #include "content/browser/frame_host/frame_accessibility.h"
21 #include "content/browser/frame_host/frame_tree.h" 21 #include "content/browser/frame_host/frame_tree.h"
22 #include "content/browser/frame_host/frame_tree_node.h" 22 #include "content/browser/frame_host/frame_tree_node.h"
23 #include "content/browser/frame_host/navigator.h" 23 #include "content/browser/frame_host/navigator.h"
24 #include "content/browser/frame_host/navigator_impl.h"
24 #include "content/browser/frame_host/render_frame_host_delegate.h" 25 #include "content/browser/frame_host/render_frame_host_delegate.h"
25 #include "content/browser/frame_host/render_frame_proxy_host.h" 26 #include "content/browser/frame_host/render_frame_proxy_host.h"
26 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 27 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
27 #include "content/browser/geolocation/geolocation_service_context.h" 28 #include "content/browser/geolocation/geolocation_service_context.h"
28 #include "content/browser/permissions/permission_service_context.h" 29 #include "content/browser/permissions/permission_service_context.h"
29 #include "content/browser/permissions/permission_service_impl.h" 30 #include "content/browser/permissions/permission_service_impl.h"
30 #include "content/browser/renderer_host/input/input_router.h" 31 #include "content/browser/renderer_host/input/input_router.h"
31 #include "content/browser/renderer_host/input/timeout_monitor.h" 32 #include "content/browser/renderer_host/input/timeout_monitor.h"
32 #include "content/browser/renderer_host/render_process_host_impl.h" 33 #include "content/browser/renderer_host/render_process_host_impl.h"
33 #include "content/browser/renderer_host/render_view_host_delegate.h" 34 #include "content/browser/renderer_host/render_view_host_delegate.h"
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 868
868 frame_tree_node_->render_manager()->OnBeforeUnloadACK( 869 frame_tree_node_->render_manager()->OnBeforeUnloadACK(
869 unload_ack_is_for_cross_site_transition_, proceed, 870 unload_ack_is_for_cross_site_transition_, proceed,
870 before_unload_end_time); 871 before_unload_end_time);
871 872
872 // If canceled, notify the delegate to cancel its pending navigation entry. 873 // If canceled, notify the delegate to cancel its pending navigation entry.
873 if (!proceed) 874 if (!proceed)
874 render_view_host_->GetDelegate()->DidCancelLoading(); 875 render_view_host_->GetDelegate()->DidCancelLoading();
875 } 876 }
876 877
878 bool RenderFrameHostImpl::IsWaitingForBeforeUnloadACK() const {
879 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
880 switches::kEnableBrowserSideNavigation)) {
881 return is_waiting_for_beforeunload_ack_;
882 }
883 return static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
884 ->IsWaitingForBeforeUnloadACK(frame_tree_node_);
nasko 2015/01/17 00:22:01 Does it make sense to put this on the interface an
clamy 2015/01/19 17:29:20 Tried it in the latest patch set, it may be slight
885 }
886
877 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { 887 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const {
878 return render_view_host_->is_waiting_for_close_ack_ || 888 return render_view_host_->is_waiting_for_close_ack_ ||
879 rfh_state_ == STATE_PENDING_SWAP_OUT; 889 rfh_state_ == STATE_PENDING_SWAP_OUT;
880 } 890 }
881 891
882 void RenderFrameHostImpl::OnSwapOutACK() { 892 void RenderFrameHostImpl::OnSwapOutACK() {
883 OnSwappedOut(); 893 OnSwappedOut();
884 } 894 }
885 895
886 void RenderFrameHostImpl::OnSwappedOut() { 896 void RenderFrameHostImpl::OnSwappedOut() {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1406
1397 // PlzNavigate 1407 // PlzNavigate
1398 void RenderFrameHostImpl::CommitNavigation( 1408 void RenderFrameHostImpl::CommitNavigation(
1399 ResourceResponse* response, 1409 ResourceResponse* response,
1400 scoped_ptr<StreamHandle> body, 1410 scoped_ptr<StreamHandle> body,
1401 const CommonNavigationParams& common_params, 1411 const CommonNavigationParams& common_params,
1402 const CommitNavigationParams& commit_params) { 1412 const CommitNavigationParams& commit_params) {
1403 // TODO(clamy): Check if we have to add security checks for the browser plugin 1413 // TODO(clamy): Check if we have to add security checks for the browser plugin
1404 // guests. 1414 // guests.
1405 1415
1416 // There's navigation message params waiting to be sent. Now that we're not
nasko 2015/01/17 00:22:01 nit: 'params' implies 'There're'
clamy 2015/01/19 17:29:20 The whole block was removed since it landed in the
1417 // suspended anymore, resume navigation by sending them. If we were swapped
nasko 2015/01/17 00:22:01 We don't use suspending of navigations in PlzNavig
clamy 2015/01/19 17:29:20 Same here.
1418 // out, we should also stop filtering out the IPC messages now.
1419 SetState(RenderFrameHostImpl::STATE_DEFAULT);
1420
1406 Send(new FrameMsg_CommitNavigation( 1421 Send(new FrameMsg_CommitNavigation(
1407 routing_id_, response->head, body->GetURL(), 1422 routing_id_, response->head, body->GetURL(),
1408 common_params, commit_params)); 1423 common_params, commit_params));
1409 // TODO(clamy): Check if we should start the throbber for non javascript urls 1424 // TODO(clamy): Check if we should start the throbber for non javascript urls
1410 // here. 1425 // here.
1411 1426
1412 // TODO(clamy): Release the stream handle once the renderer has finished 1427 // TODO(clamy): Release the stream handle once the renderer has finished
1413 // reading it. 1428 // reading it.
1414 stream_handle_ = body.Pass(); 1429 stream_handle_ = body.Pass();
1415 } 1430 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1625 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1611 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1626 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1612 GetContentClient()->browser()->RegisterPermissionUsage( 1627 GetContentClient()->browser()->RegisterPermissionUsage(
1613 PERMISSION_GEOLOCATION, 1628 PERMISSION_GEOLOCATION,
1614 delegate_->GetAsWebContents(), 1629 delegate_->GetAsWebContents(),
1615 GetLastCommittedURL().GetOrigin(), 1630 GetLastCommittedURL().GetOrigin(),
1616 top_frame->GetLastCommittedURL().GetOrigin()); 1631 top_frame->GetLastCommittedURL().GetOrigin());
1617 } 1632 }
1618 1633
1619 } // namespace content 1634 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698