Chromium Code Reviews| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", | 785 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.UI_OnLoadComplete.Intent", |
| 786 base::TimeTicks::Now() - ui_timestamp, | 786 base::TimeTicks::Now() - ui_timestamp, |
| 787 base::TimeDelta::FromMilliseconds(10), | 787 base::TimeDelta::FromMilliseconds(10), |
| 788 base::TimeDelta::FromMinutes(10), 100); | 788 base::TimeDelta::FromMinutes(10), 100); |
| 789 } | 789 } |
| 790 // This message is only sent for top-level frames. TODO(avi): when frame tree | 790 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 791 // mirroring works correctly, add a check here to enforce it. | 791 // mirroring works correctly, add a check here to enforce it. |
| 792 delegate_->DocumentOnLoadCompleted(this); | 792 delegate_->DocumentOnLoadCompleted(this); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame(const GURL& url) { | 795 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( |
| 796 frame_tree_node_->navigator()->DidStartProvisionalLoad( | 796 const GURL& url, |
| 797 this, url); | 797 const base::TimeTicks& navigation_start) { |
| 798 DCHECK(!navigation_start.is_null()); | |
| 799 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, | |
| 800 navigation_start); | |
| 798 } | 801 } |
| 799 | 802 |
| 800 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( | 803 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( |
| 801 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 804 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 802 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 805 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 803 switches::kEnableBrowserSideNavigation) && | 806 switches::kEnableBrowserSideNavigation) && |
| 804 navigation_handle_) { | 807 navigation_handle_) { |
| 805 navigation_handle_->set_net_error_code( | 808 navigation_handle_->set_net_error_code( |
| 806 static_cast<net::Error>(params.error_code)); | 809 static_cast<net::Error>(params.error_code)); |
| 807 } | 810 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 925 // same-process navigation is interrupted by a synchronous renderer-initiated | 928 // same-process navigation is interrupted by a synchronous renderer-initiated |
| 926 // navigation. | 929 // navigation. |
| 927 if (navigation_handle_ && | 930 if (navigation_handle_ && |
| 928 navigation_handle_->GetURL() != validated_params.url) { | 931 navigation_handle_->GetURL() != validated_params.url) { |
| 929 navigation_handle_.reset(); | 932 navigation_handle_.reset(); |
| 930 } | 933 } |
| 931 | 934 |
| 932 // Synchronous renderer-initiated navigations will send a | 935 // Synchronous renderer-initiated navigations will send a |
| 933 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 936 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
| 934 // message. | 937 // message. |
| 938 // TODO(csharrison) Should we use a timestamp logged in the renderer here? | |
| 935 if (!navigation_handle_) { | 939 if (!navigation_handle_) { |
| 936 navigation_handle_ = NavigationHandleImpl::Create( | 940 navigation_handle_ = NavigationHandleImpl::Create( |
| 937 validated_params.url, frame_tree_node_); | 941 validated_params.url, frame_tree_node_, base::TimeTicks::Now()); |
| 938 } | 942 } |
| 939 | 943 |
| 940 accessibility_reset_count_ = 0; | 944 accessibility_reset_count_ = 0; |
| 941 frame_tree_node()->navigator()->DidNavigate(this, validated_params); | 945 frame_tree_node()->navigator()->DidNavigate(this, validated_params); |
| 942 | 946 |
| 943 // For a top-level frame, there are potential security concerns associated | 947 // For a top-level frame, there are potential security concerns associated |
| 944 // with displaying graphics from a previously loaded page after the URL in | 948 // with displaying graphics from a previously loaded page after the URL in |
| 945 // the omnibar has been changed. It is unappealing to clear the page | 949 // the omnibar has been changed. It is unappealing to clear the page |
| 946 // immediately, but if the renderer is taking a long time to issue any | 950 // immediately, but if the renderer is taking a long time to issue any |
| 947 // compositor output (possibly because of script deliberately creating this | 951 // compositor output (possibly because of script deliberately creating this |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1762 // done here either. | 1766 // done here either. |
| 1763 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 1767 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
| 1764 frame_tree_node_->DidStartLoading(true); | 1768 frame_tree_node_->DidStartLoading(true); |
| 1765 } | 1769 } |
| 1766 | 1770 |
| 1767 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 1771 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
| 1768 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 1772 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
| 1769 CommonNavigationParams common_params( | 1773 CommonNavigationParams common_params( |
| 1770 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 1774 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
| 1771 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 1775 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
| 1772 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 1776 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
| 1773 LOFI_OFF); | 1777 base::TimeTicks::Now()); |
| 1774 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1778 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1775 switches::kEnableBrowserSideNavigation)) { | 1779 switches::kEnableBrowserSideNavigation)) { |
| 1776 CommitNavigation(nullptr, nullptr, common_params, | 1780 CommitNavigation(nullptr, nullptr, common_params, |
| 1777 RequestNavigationParams()); | 1781 RequestNavigationParams()); |
| 1778 } else { | 1782 } else { |
| 1779 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 1783 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
| 1780 } | 1784 } |
| 1781 } | 1785 } |
| 1782 | 1786 |
| 1783 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 1787 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2145 "RenderFrameHostImpl navigation suspended", this); | 2149 "RenderFrameHostImpl navigation suspended", this); |
| 2146 } | 2150 } |
| 2147 | 2151 |
| 2148 if (!suspend && suspended_nav_params_) { | 2152 if (!suspend && suspended_nav_params_) { |
| 2149 // There's navigation message params waiting to be sent. Now that we're not | 2153 // There's navigation message params waiting to be sent. Now that we're not |
| 2150 // suspended anymore, resume navigation by sending them. If we were swapped | 2154 // suspended anymore, resume navigation by sending them. If we were swapped |
| 2151 // out, we should also stop filtering out the IPC messages now. | 2155 // out, we should also stop filtering out the IPC messages now. |
| 2152 SetState(RenderFrameHostImpl::STATE_DEFAULT); | 2156 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
| 2153 | 2157 |
| 2154 DCHECK(!proceed_time.is_null()); | 2158 DCHECK(!proceed_time.is_null()); |
| 2155 suspended_nav_params_->request_params.browser_navigation_start = | 2159 suspended_nav_params_->common_params.navigation_start = proceed_time; |
|
clamy
2015/11/03 13:33:00
This is somewhat problematic. We pushed the naviga
| |
| 2156 proceed_time; | |
| 2157 SendNavigateMessage(suspended_nav_params_->common_params, | 2160 SendNavigateMessage(suspended_nav_params_->common_params, |
| 2158 suspended_nav_params_->start_params, | 2161 suspended_nav_params_->start_params, |
| 2159 suspended_nav_params_->request_params); | 2162 suspended_nav_params_->request_params); |
| 2160 suspended_nav_params_.reset(); | 2163 suspended_nav_params_.reset(); |
| 2161 } | 2164 } |
| 2162 } | 2165 } |
| 2163 | 2166 |
| 2164 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 2167 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
| 2165 // Clear any state if a pending navigation is canceled or preempted. | 2168 // Clear any state if a pending navigation is canceled or preempted. |
| 2166 if (suspended_nav_params_) | 2169 if (suspended_nav_params_) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2306 *dst = src; | 2309 *dst = src; |
| 2307 | 2310 |
| 2308 if (src.routing_id != -1) | 2311 if (src.routing_id != -1) |
| 2309 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2312 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
| 2310 | 2313 |
| 2311 if (src.parent_routing_id != -1) | 2314 if (src.parent_routing_id != -1) |
| 2312 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2315 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
| 2313 } | 2316 } |
| 2314 | 2317 |
| 2315 } // namespace content | 2318 } // namespace content |
| OLD | NEW |