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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 DCHECK(!IsBrowserSideNavigationEnabled() || !to_different_document); | |
nasko
2016/02/10 23:02:19
If the renderer is no longer supposed to be sendin
clamy
2016/02/11 15:36:40
Done.
| |
1706 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); | 1714 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); |
1707 is_loading_ = true; | 1715 is_loading_ = true; |
1708 frame_tree_node_->DidStartLoading(to_different_document, | 1716 frame_tree_node_->DidStartLoading(to_different_document, |
1709 was_previously_loading); | 1717 was_previously_loading); |
1710 } | 1718 } |
1711 | 1719 |
1712 void RenderFrameHostImpl::OnDidStopLoading() { | 1720 void RenderFrameHostImpl::OnDidStopLoading() { |
1713 // This method should never be called when the frame is not loading. | 1721 // This method should never be called when the frame is not loading. |
1714 // Unfortunately, it can happen if a history navigation happens during a | 1722 // Unfortunately, it can happen if a history navigation happens during a |
1715 // BeforeUnload or Unload event. | 1723 // BeforeUnload or Unload event. |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2560 *dst = src; | 2568 *dst = src; |
2561 | 2569 |
2562 if (src.routing_id != -1) | 2570 if (src.routing_id != -1) |
2563 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2571 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2564 | 2572 |
2565 if (src.parent_routing_id != -1) | 2573 if (src.parent_routing_id != -1) |
2566 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2574 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2567 } | 2575 } |
2568 | 2576 |
2569 } // namespace content | 2577 } // namespace content |
OLD | NEW |