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 "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" |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", | 784 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", |
785 base::TimeTicks::Now() - ui_timestamp, | 785 base::TimeTicks::Now() - ui_timestamp, |
786 base::TimeDelta::FromMilliseconds(10), | 786 base::TimeDelta::FromMilliseconds(10), |
787 base::TimeDelta::FromMinutes(10), 100); | 787 base::TimeDelta::FromMinutes(10), 100); |
788 } | 788 } |
789 // This message is only sent for top-level frames. TODO(avi): when frame tree | 789 // This message is only sent for top-level frames. TODO(avi): when frame tree |
790 // mirroring works correctly, add a check here to enforce it. | 790 // mirroring works correctly, add a check here to enforce it. |
791 delegate_->DocumentOnLoadCompleted(this); | 791 delegate_->DocumentOnLoadCompleted(this); |
792 } | 792 } |
793 | 793 |
794 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame(const GURL& url) { | 794 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( |
795 frame_tree_node_->navigator()->DidStartProvisionalLoad( | 795 const GURL& url, |
796 this, url); | 796 const base::TimeTicks& navigation_start) { |
| 797 DCHECK(!navigation_start.is_null()); |
| 798 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, |
| 799 navigation_start); |
797 } | 800 } |
798 | 801 |
799 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( | 802 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( |
800 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 803 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
801 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 804 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
802 switches::kEnableBrowserSideNavigation) && | 805 switches::kEnableBrowserSideNavigation) && |
803 navigation_handle_) { | 806 navigation_handle_) { |
804 navigation_handle_->set_net_error_code( | 807 navigation_handle_->set_net_error_code( |
805 static_cast<net::Error>(params.error_code)); | 808 static_cast<net::Error>(params.error_code)); |
806 } | 809 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // same-process navigation is interrupted by a synchronous renderer-initiated | 927 // same-process navigation is interrupted by a synchronous renderer-initiated |
925 // navigation. | 928 // navigation. |
926 if (navigation_handle_ && | 929 if (navigation_handle_ && |
927 navigation_handle_->GetURL() != validated_params.url) { | 930 navigation_handle_->GetURL() != validated_params.url) { |
928 navigation_handle_.reset(); | 931 navigation_handle_.reset(); |
929 } | 932 } |
930 | 933 |
931 // Synchronous renderer-initiated navigations will send a | 934 // Synchronous renderer-initiated navigations will send a |
932 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 935 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
933 // message. | 936 // message. |
| 937 // TODO(csharrison) Should we use a timestamp logged in the renderer here? |
934 if (!navigation_handle_) { | 938 if (!navigation_handle_) { |
935 navigation_handle_ = NavigationHandleImpl::Create( | 939 navigation_handle_ = NavigationHandleImpl::Create( |
936 validated_params.url, frame_tree_node_); | 940 validated_params.url, frame_tree_node_, base::TimeTicks::Now()); |
937 } | 941 } |
938 | 942 |
939 accessibility_reset_count_ = 0; | 943 accessibility_reset_count_ = 0; |
940 frame_tree_node()->navigator()->DidNavigate(this, validated_params); | 944 frame_tree_node()->navigator()->DidNavigate(this, validated_params); |
941 | 945 |
942 // For a top-level frame, there are potential security concerns associated | 946 // For a top-level frame, there are potential security concerns associated |
943 // with displaying graphics from a previously loaded page after the URL in | 947 // with displaying graphics from a previously loaded page after the URL in |
944 // the omnibar has been changed. It is unappealing to clear the page | 948 // the omnibar has been changed. It is unappealing to clear the page |
945 // immediately, but if the renderer is taking a long time to issue any | 949 // immediately, but if the renderer is taking a long time to issue any |
946 // compositor output (possibly because of script deliberately creating this | 950 // compositor output (possibly because of script deliberately creating this |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 // done here either. | 1753 // done here either. |
1750 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 1754 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
1751 frame_tree_node_->DidStartLoading(true); | 1755 frame_tree_node_->DidStartLoading(true); |
1752 } | 1756 } |
1753 | 1757 |
1754 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 1758 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
1755 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 1759 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
1756 CommonNavigationParams common_params( | 1760 CommonNavigationParams common_params( |
1757 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 1761 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
1758 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 1762 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
1759 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 1763 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
1760 LOFI_OFF); | 1764 base::TimeTicks::Now()); |
1761 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1765 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1762 switches::kEnableBrowserSideNavigation)) { | 1766 switches::kEnableBrowserSideNavigation)) { |
1763 CommitNavigation(nullptr, nullptr, common_params, | 1767 CommitNavigation(nullptr, nullptr, common_params, |
1764 RequestNavigationParams()); | 1768 RequestNavigationParams()); |
1765 } else { | 1769 } else { |
1766 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 1770 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
1767 } | 1771 } |
1768 } | 1772 } |
1769 | 1773 |
1770 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 1774 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 "RenderFrameHostImpl navigation suspended", this); | 2136 "RenderFrameHostImpl navigation suspended", this); |
2133 } | 2137 } |
2134 | 2138 |
2135 if (!suspend && suspended_nav_params_) { | 2139 if (!suspend && suspended_nav_params_) { |
2136 // There's navigation message params waiting to be sent. Now that we're not | 2140 // There's navigation message params waiting to be sent. Now that we're not |
2137 // suspended anymore, resume navigation by sending them. If we were swapped | 2141 // suspended anymore, resume navigation by sending them. If we were swapped |
2138 // out, we should also stop filtering out the IPC messages now. | 2142 // out, we should also stop filtering out the IPC messages now. |
2139 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 2143 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
2140 | 2144 |
2141 DCHECK(!proceed_time.is_null()); | 2145 DCHECK(!proceed_time.is_null()); |
2142 suspended_nav_params_->request_params.browser_navigation_start = | 2146 suspended_nav_params_->common_params.navigation_start = proceed_time; |
2143 proceed_time; | |
2144 SendNavigateMessage(suspended_nav_params_->common_params, | 2147 SendNavigateMessage(suspended_nav_params_->common_params, |
2145 suspended_nav_params_->start_params, | 2148 suspended_nav_params_->start_params, |
2146 suspended_nav_params_->request_params); | 2149 suspended_nav_params_->request_params); |
2147 suspended_nav_params_.reset(); | 2150 suspended_nav_params_.reset(); |
2148 } | 2151 } |
2149 } | 2152 } |
2150 | 2153 |
2151 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 2154 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
2152 // Clear any state if a pending navigation is canceled or preempted. | 2155 // Clear any state if a pending navigation is canceled or preempted. |
2153 if (suspended_nav_params_) | 2156 if (suspended_nav_params_) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 *dst = src; | 2296 *dst = src; |
2294 | 2297 |
2295 if (src.routing_id != -1) | 2298 if (src.routing_id != -1) |
2296 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2299 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2297 | 2300 |
2298 if (src.parent_routing_id != -1) | 2301 if (src.parent_routing_id != -1) |
2299 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2302 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2300 } | 2303 } |
2301 | 2304 |
2302 } // namespace content | 2305 } // namespace content |
OLD | NEW |