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

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

Issue 1608283002: PlzNavigate: Use WebNavigationPolicyHandledByClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@change-did-start-loading-logic
Patch Set: Rebase + addressed comments Created 4 years, 10 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
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 // Synchronous renderer-initiated navigations will send a 1022 // Synchronous renderer-initiated navigations will send a
1023 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad 1023 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad
1024 // message. 1024 // message.
1025 if (!navigation_handle_) { 1025 if (!navigation_handle_) {
1026 navigation_handle_ = 1026 navigation_handle_ =
1027 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, 1027 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_,
1028 true, // is_synchronous 1028 true, // is_synchronous
1029 false, // is_srcdoc 1029 false, // is_srcdoc
1030 base::TimeTicks::Now()); 1030 base::TimeTicks::Now());
1031 // PlzNavigate
1032 if (IsBrowserSideNavigationEnabled()) {
1033 // PlzNavigate: synchronous loads happen in the renderer, and the browser
1034 // has not been notified about the start of the load yet. Do it now.
1035 if (!is_loading()) {
1036 bool was_loading = frame_tree_node()->frame_tree()->IsLoading();
1037 is_loading_ = true;
1038 frame_tree_node()->DidStartLoading(true, was_loading);
1039 }
1040 pending_commit_ = false;
1041 }
1031 } 1042 }
1032 1043
1033 accessibility_reset_count_ = 0; 1044 accessibility_reset_count_ = 0;
1034 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 1045 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
1035 1046
1036 // For a top-level frame, there are potential security concerns associated 1047 // For a top-level frame, there are potential security concerns associated
1037 // with displaying graphics from a previously loaded page after the URL in 1048 // with displaying graphics from a previously loaded page after the URL in
1038 // the omnibar has been changed. It is unappealing to clear the page 1049 // the omnibar has been changed. It is unappealing to clear the page
1039 // immediately, but if the renderer is taking a long time to issue any 1050 // immediately, but if the renderer is taking a long time to issue any
1040 // compositor output (possibly because of script deliberately creating this 1051 // compositor output (possibly because of script deliberately creating this
1041 // situation) then we clear it after a while anyway. 1052 // situation) then we clear it after a while anyway.
1042 // See https://crbug.com/497588. 1053 // See https://crbug.com/497588.
1043 if (frame_tree_node_->IsMainFrame() && GetView() && 1054 if (frame_tree_node_->IsMainFrame() && GetView() &&
1044 !validated_params.was_within_same_page) { 1055 !validated_params.was_within_same_page) {
1045 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost()) 1056 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())
1046 ->StartNewContentRenderingTimeout(); 1057 ->StartNewContentRenderingTimeout();
1047 } 1058 }
1048
1049 // PlzNavigate
1050 if (IsBrowserSideNavigationEnabled())
1051 pending_commit_ = false;
1052 } 1059 }
1053 1060
1054 void RenderFrameHostImpl::OnUpdateState(const PageState& state) { 1061 void RenderFrameHostImpl::OnUpdateState(const PageState& state) {
1055 // TODO(creis): Verify the state's ISN matches the last committed FNE. 1062 // TODO(creis): Verify the state's ISN matches the last committed FNE.
1056 1063
1057 // Without this check, the renderer can trick the browser into using 1064 // Without this check, the renderer can trick the browser into using
1058 // filenames it can't access in a future session restore. 1065 // filenames it can't access in a future session restore.
1059 // TODO(creis): Move CanAccessFilesOfPageState to RenderFrameHostImpl. 1066 // TODO(creis): Move CanAccessFilesOfPageState to RenderFrameHostImpl.
1060 if (!render_view_host_->CanAccessFilesOfPageState(state)) { 1067 if (!render_view_host_->CanAccessFilesOfPageState(state)) {
1061 bad_message::ReceivedBadMessage( 1068 bad_message::ReceivedBadMessage(
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); 1703 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin());
1697 else 1704 else
1698 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); 1705 delegate_->ExitFullscreenMode(/* will_cause_resize */ true);
1699 1706
1700 // The previous call might change the fullscreen state. We need to make sure 1707 // The previous call might change the fullscreen state. We need to make sure
1701 // the renderer is aware of that, which is done via the resize message. 1708 // the renderer is aware of that, which is done via the resize message.
1702 render_view_host_->GetWidget()->WasResized(); 1709 render_view_host_->GetWidget()->WasResized();
1703 } 1710 }
1704 1711
1705 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { 1712 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) {
1713 if (IsBrowserSideNavigationEnabled() && to_different_document) {
1714 bad_message::ReceivedBadMessage(GetProcess(),
1715 bad_message::RFH_UNEXPECTED_LOAD_START);
nasko 2016/02/11 15:47:30 Do we want to proceed further in this method if th
clamy 2016/02/12 12:33:21 Done.
1716 }
1706 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); 1717 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading();
1707 is_loading_ = true; 1718 is_loading_ = true;
1708 1719
1709 // Only inform the FrameTreeNode of a change in load state if the load state 1720 // Only inform the FrameTreeNode of a change in load state if the load state
1710 // of this RenderFrameHost is being tracked. 1721 // of this RenderFrameHost is being tracked.
1711 bool is_load_tracked = 1722 bool is_load_tracked =
1712 this == frame_tree_node_->render_manager()->current_frame_host() || 1723 this == frame_tree_node_->render_manager()->current_frame_host() ||
1713 (IsBrowserSideNavigationEnabled() 1724 (IsBrowserSideNavigationEnabled()
1714 ? this == 1725 ? this ==
1715 frame_tree_node_->render_manager()->speculative_frame_host() 1726 frame_tree_node_->render_manager()->speculative_frame_host()
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 *dst = src; 2598 *dst = src;
2588 2599
2589 if (src.routing_id != -1) 2600 if (src.routing_id != -1)
2590 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2601 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2591 2602
2592 if (src.parent_routing_id != -1) 2603 if (src.parent_routing_id != -1)
2593 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2604 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2594 } 2605 }
2595 2606
2596 } // namespace content 2607 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698