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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 } | 1648 } |
1649 | 1649 |
1650 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { | 1650 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { |
1651 // This message is only sent for top-level frames. TODO(avi): when frame tree | 1651 // This message is only sent for top-level frames. TODO(avi): when frame tree |
1652 // mirroring works correctly, add a check here to enforce it. | 1652 // mirroring works correctly, add a check here to enforce it. |
1653 delegate_->UpdateEncoding(this, encoding_name); | 1653 delegate_->UpdateEncoding(this, encoding_name); |
1654 } | 1654 } |
1655 | 1655 |
1656 void RenderFrameHostImpl::OnBeginNavigation( | 1656 void RenderFrameHostImpl::OnBeginNavigation( |
1657 const CommonNavigationParams& common_params, | 1657 const CommonNavigationParams& common_params, |
1658 const BeginNavigationParams& begin_params, | 1658 const BeginNavigationParams& begin_params) { |
1659 scoped_refptr<ResourceRequestBody> body) { | |
1660 CHECK(IsBrowserSideNavigationEnabled()); | 1659 CHECK(IsBrowserSideNavigationEnabled()); |
1661 CommonNavigationParams validated_params = common_params; | 1660 CommonNavigationParams validated_params = common_params; |
1662 GetProcess()->FilterURL(false, &validated_params.url); | 1661 GetProcess()->FilterURL(false, &validated_params.url); |
1663 frame_tree_node()->navigator()->OnBeginNavigation( | 1662 frame_tree_node()->navigator()->OnBeginNavigation( |
1664 frame_tree_node(), validated_params, begin_params, body); | 1663 frame_tree_node(), validated_params, begin_params); |
1665 } | 1664 } |
1666 | 1665 |
1667 void RenderFrameHostImpl::OnDispatchLoad() { | 1666 void RenderFrameHostImpl::OnDispatchLoad() { |
1668 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 1667 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
1669 // Only frames with an out-of-process parent frame should be sending this | 1668 // Only frames with an out-of-process parent frame should be sending this |
1670 // message. | 1669 // message. |
1671 RenderFrameProxyHost* proxy = | 1670 RenderFrameProxyHost* proxy = |
1672 frame_tree_node()->render_manager()->GetProxyToParent(); | 1671 frame_tree_node()->render_manager()->GetProxyToParent(); |
1673 if (!proxy) { | 1672 if (!proxy) { |
1674 bad_message::ReceivedBadMessage(GetProcess(), | 1673 bad_message::ReceivedBadMessage(GetProcess(), |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 2106 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
2108 OnDidStartLoading(true); | 2107 OnDidStartLoading(true); |
2109 } | 2108 } |
2110 | 2109 |
2111 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2110 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2112 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2111 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2113 CommonNavigationParams common_params( | 2112 CommonNavigationParams common_params( |
2114 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2113 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2115 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2114 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2116 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2115 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2117 base::TimeTicks::Now(), "GET"); | 2116 base::TimeTicks::Now(), "GET", nullptr); |
2118 if (IsBrowserSideNavigationEnabled()) { | 2117 if (IsBrowserSideNavigationEnabled()) { |
2119 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2118 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2120 false, nullptr); | 2119 false); |
2121 } else { | 2120 } else { |
2122 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2121 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2123 } | 2122 } |
2124 } | 2123 } |
2125 | 2124 |
2126 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 2125 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
2127 SiteInstance* source_site_instance) { | 2126 SiteInstance* source_site_instance) { |
2128 GURL validated_url(params.url); | 2127 GURL validated_url(params.url); |
2129 GetProcess()->FilterURL(false, &validated_url); | 2128 GetProcess()->FilterURL(false, &validated_url); |
2130 | 2129 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 render_view_host_->GetWidget()); | 2240 render_view_host_->GetWidget()); |
2242 } | 2241 } |
2243 } | 2242 } |
2244 | 2243 |
2245 // PlzNavigate | 2244 // PlzNavigate |
2246 void RenderFrameHostImpl::CommitNavigation( | 2245 void RenderFrameHostImpl::CommitNavigation( |
2247 ResourceResponse* response, | 2246 ResourceResponse* response, |
2248 std::unique_ptr<StreamHandle> body, | 2247 std::unique_ptr<StreamHandle> body, |
2249 const CommonNavigationParams& common_params, | 2248 const CommonNavigationParams& common_params, |
2250 const RequestNavigationParams& request_params, | 2249 const RequestNavigationParams& request_params, |
2251 bool is_view_source, | 2250 bool is_view_source) { |
2252 scoped_refptr<ResourceRequestBody> post_data) { | |
2253 DCHECK((response && body.get()) || | 2251 DCHECK((response && body.get()) || |
2254 !ShouldMakeNetworkRequestForURL(common_params.url)); | 2252 !ShouldMakeNetworkRequestForURL(common_params.url)); |
2255 UpdatePermissionsForNavigation(common_params, request_params); | 2253 UpdatePermissionsForNavigation(common_params, request_params); |
2256 | 2254 |
2257 // Get back to a clean state, in case we start a new navigation without | 2255 // Get back to a clean state, in case we start a new navigation without |
2258 // completing an unload handler. | 2256 // completing an unload handler. |
2259 ResetWaitingState(); | 2257 ResetWaitingState(); |
2260 | 2258 |
2261 // The renderer can exit view source mode when any error or cancellation | 2259 // The renderer can exit view source mode when any error or cancellation |
2262 // happen. When reusing the same renderer, overwrite to recover the mode. | 2260 // happen. When reusing the same renderer, overwrite to recover the mode. |
2263 if (is_view_source && | 2261 if (is_view_source && |
2264 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2262 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2265 DCHECK(!GetParent()); | 2263 DCHECK(!GetParent()); |
2266 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2264 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2267 } | 2265 } |
2268 | 2266 |
2269 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2267 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2270 const ResourceResponseHead head = response ? | 2268 const ResourceResponseHead head = response ? |
2271 response->head : ResourceResponseHead(); | 2269 response->head : ResourceResponseHead(); |
2272 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2270 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2273 request_params, post_data)); | 2271 request_params)); |
2274 | 2272 |
2275 // If a network request was made, update the LoFi state. | 2273 // If a network request was made, update the LoFi state. |
2276 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2274 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
2277 last_navigation_lofi_state_ = common_params.lofi_state; | 2275 last_navigation_lofi_state_ = common_params.lofi_state; |
2278 | 2276 |
2279 // TODO(clamy): Release the stream handle once the renderer has finished | 2277 // TODO(clamy): Release the stream handle once the renderer has finished |
2280 // reading it. | 2278 // reading it. |
2281 stream_handle_ = std::move(body); | 2279 stream_handle_ = std::move(body); |
2282 | 2280 |
2283 // When navigating to a Javascript url, no commit is expected from the | 2281 // When navigating to a Javascript url, no commit is expected from the |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2841 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2844 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2842 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2845 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2843 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2846 } | 2844 } |
2847 | 2845 |
2848 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2846 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2849 web_bluetooth_service_.reset(); | 2847 web_bluetooth_service_.reset(); |
2850 } | 2848 } |
2851 | 2849 |
2852 } // namespace content | 2850 } // namespace content |
OLD | NEW |