OLD | NEW |
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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1025 |
1026 // Synchronous renderer-initiated navigations will send a | 1026 // Synchronous renderer-initiated navigations will send a |
1027 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 1027 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
1028 // message. | 1028 // message. |
1029 if (!navigation_handle_) { | 1029 if (!navigation_handle_) { |
1030 navigation_handle_ = | 1030 navigation_handle_ = |
1031 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, | 1031 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, |
1032 true, // is_synchronous | 1032 true, // is_synchronous |
1033 validated_params.is_srcdoc, | 1033 validated_params.is_srcdoc, |
1034 base::TimeTicks::Now()); | 1034 base::TimeTicks::Now()); |
| 1035 // PlzNavigate |
| 1036 if (IsBrowserSideNavigationEnabled()) { |
| 1037 // PlzNavigate: synchronous loads happen in the renderer, and the browser |
| 1038 // has not been notified about the start of the load yet. Do it now. |
| 1039 if (!is_loading()) { |
| 1040 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); |
| 1041 is_loading_ = true; |
| 1042 frame_tree_node()->DidStartLoading(true, was_loading); |
| 1043 } |
| 1044 pending_commit_ = false; |
| 1045 } |
1035 } | 1046 } |
1036 | 1047 |
1037 accessibility_reset_count_ = 0; | 1048 accessibility_reset_count_ = 0; |
1038 frame_tree_node()->navigator()->DidNavigate(this, validated_params); | 1049 frame_tree_node()->navigator()->DidNavigate(this, validated_params); |
1039 | 1050 |
1040 // For a top-level frame, there are potential security concerns associated | 1051 // For a top-level frame, there are potential security concerns associated |
1041 // with displaying graphics from a previously loaded page after the URL in | 1052 // with displaying graphics from a previously loaded page after the URL in |
1042 // the omnibar has been changed. It is unappealing to clear the page | 1053 // the omnibar has been changed. It is unappealing to clear the page |
1043 // immediately, but if the renderer is taking a long time to issue any | 1054 // immediately, but if the renderer is taking a long time to issue any |
1044 // compositor output (possibly because of script deliberately creating this | 1055 // compositor output (possibly because of script deliberately creating this |
1045 // situation) then we clear it after a while anyway. | 1056 // situation) then we clear it after a while anyway. |
1046 // See https://crbug.com/497588. | 1057 // See https://crbug.com/497588. |
1047 if (frame_tree_node_->IsMainFrame() && GetView() && | 1058 if (frame_tree_node_->IsMainFrame() && GetView() && |
1048 !validated_params.was_within_same_page) { | 1059 !validated_params.was_within_same_page) { |
1049 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost()) | 1060 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost()) |
1050 ->StartNewContentRenderingTimeout(); | 1061 ->StartNewContentRenderingTimeout(); |
1051 } | 1062 } |
1052 | |
1053 // PlzNavigate | |
1054 if (IsBrowserSideNavigationEnabled()) | |
1055 pending_commit_ = false; | |
1056 } | 1063 } |
1057 | 1064 |
1058 void RenderFrameHostImpl::OnUpdateState(const PageState& state) { | 1065 void RenderFrameHostImpl::OnUpdateState(const PageState& state) { |
1059 // TODO(creis): Verify the state's ISN matches the last committed FNE. | 1066 // TODO(creis): Verify the state's ISN matches the last committed FNE. |
1060 | 1067 |
1061 // Without this check, the renderer can trick the browser into using | 1068 // Without this check, the renderer can trick the browser into using |
1062 // filenames it can't access in a future session restore. | 1069 // filenames it can't access in a future session restore. |
1063 // TODO(creis): Move CanAccessFilesOfPageState to RenderFrameHostImpl. | 1070 // TODO(creis): Move CanAccessFilesOfPageState to RenderFrameHostImpl. |
1064 if (!render_view_host_->CanAccessFilesOfPageState(state)) { | 1071 if (!render_view_host_->CanAccessFilesOfPageState(state)) { |
1065 bad_message::ReceivedBadMessage( | 1072 bad_message::ReceivedBadMessage( |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); | 1705 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); |
1699 else | 1706 else |
1700 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); | 1707 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); |
1701 | 1708 |
1702 // The previous call might change the fullscreen state. We need to make sure | 1709 // The previous call might change the fullscreen state. We need to make sure |
1703 // the renderer is aware of that, which is done via the resize message. | 1710 // the renderer is aware of that, which is done via the resize message. |
1704 render_view_host_->GetWidget()->WasResized(); | 1711 render_view_host_->GetWidget()->WasResized(); |
1705 } | 1712 } |
1706 | 1713 |
1707 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { | 1714 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { |
| 1715 if (IsBrowserSideNavigationEnabled() && to_different_document) { |
| 1716 bad_message::ReceivedBadMessage(GetProcess(), |
| 1717 bad_message::RFH_UNEXPECTED_LOAD_START); |
| 1718 return; |
| 1719 } |
1708 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); | 1720 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); |
1709 is_loading_ = true; | 1721 is_loading_ = true; |
1710 | 1722 |
1711 // Only inform the FrameTreeNode of a change in load state if the load state | 1723 // Only inform the FrameTreeNode of a change in load state if the load state |
1712 // of this RenderFrameHost is being tracked. | 1724 // of this RenderFrameHost is being tracked. |
1713 if (rfh_state_ == STATE_DEFAULT) { | 1725 if (rfh_state_ == STATE_DEFAULT) { |
1714 frame_tree_node_->DidStartLoading(to_different_document, | 1726 frame_tree_node_->DidStartLoading(to_different_document, |
1715 was_previously_loading); | 1727 was_previously_loading); |
1716 } | 1728 } |
1717 } | 1729 } |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 *dst = src; | 2589 *dst = src; |
2578 | 2590 |
2579 if (src.routing_id != -1) | 2591 if (src.routing_id != -1) |
2580 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2592 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2581 | 2593 |
2582 if (src.parent_routing_id != -1) | 2594 if (src.parent_routing_id != -1) |
2583 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2595 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2584 } | 2596 } |
2585 | 2597 |
2586 } // namespace content | 2598 } // namespace content |
OLD | NEW |