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 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 | 2110 |
2111 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2111 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2112 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2112 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2113 CommonNavigationParams common_params( | 2113 CommonNavigationParams common_params( |
2114 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2114 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2115 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2115 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2116 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2116 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2117 base::TimeTicks::Now(), "GET"); | 2117 base::TimeTicks::Now(), "GET"); |
2118 if (IsBrowserSideNavigationEnabled()) { | 2118 if (IsBrowserSideNavigationEnabled()) { |
2119 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2119 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2120 false); | 2120 false, nullptr); |
2121 } else { | 2121 } else { |
2122 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2122 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2123 } | 2123 } |
2124 } | 2124 } |
2125 | 2125 |
2126 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 2126 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
2127 SiteInstance* source_site_instance) { | 2127 SiteInstance* source_site_instance) { |
2128 GURL validated_url(params.url); | 2128 GURL validated_url(params.url); |
2129 GetProcess()->FilterURL(false, &validated_url); | 2129 GetProcess()->FilterURL(false, &validated_url); |
2130 | 2130 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 render_view_host_->GetWidget()); | 2241 render_view_host_->GetWidget()); |
2242 } | 2242 } |
2243 } | 2243 } |
2244 | 2244 |
2245 // PlzNavigate | 2245 // PlzNavigate |
2246 void RenderFrameHostImpl::CommitNavigation( | 2246 void RenderFrameHostImpl::CommitNavigation( |
2247 ResourceResponse* response, | 2247 ResourceResponse* response, |
2248 std::unique_ptr<StreamHandle> body, | 2248 std::unique_ptr<StreamHandle> body, |
2249 const CommonNavigationParams& common_params, | 2249 const CommonNavigationParams& common_params, |
2250 const RequestNavigationParams& request_params, | 2250 const RequestNavigationParams& request_params, |
2251 bool is_view_source) { | 2251 bool is_view_source, |
| 2252 scoped_refptr<ResourceRequestBody> post_data) { |
2252 DCHECK((response && body.get()) || | 2253 DCHECK((response && body.get()) || |
2253 !ShouldMakeNetworkRequestForURL(common_params.url)); | 2254 !ShouldMakeNetworkRequestForURL(common_params.url)); |
2254 UpdatePermissionsForNavigation(common_params, request_params); | 2255 UpdatePermissionsForNavigation(common_params, request_params); |
2255 | 2256 |
2256 // Get back to a clean state, in case we start a new navigation without | 2257 // Get back to a clean state, in case we start a new navigation without |
2257 // completing an unload handler. | 2258 // completing an unload handler. |
2258 ResetWaitingState(); | 2259 ResetWaitingState(); |
2259 | 2260 |
2260 // The renderer can exit view source mode when any error or cancellation | 2261 // The renderer can exit view source mode when any error or cancellation |
2261 // happen. When reusing the same renderer, overwrite to recover the mode. | 2262 // happen. When reusing the same renderer, overwrite to recover the mode. |
2262 if (is_view_source && | 2263 if (is_view_source && |
2263 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2264 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2264 DCHECK(!GetParent()); | 2265 DCHECK(!GetParent()); |
2265 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2266 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2266 } | 2267 } |
2267 | 2268 |
2268 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2269 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2269 const ResourceResponseHead head = response ? | 2270 const ResourceResponseHead head = response ? |
2270 response->head : ResourceResponseHead(); | 2271 response->head : ResourceResponseHead(); |
2271 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2272 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2272 request_params)); | 2273 request_params, post_data)); |
2273 | 2274 |
2274 // If a network request was made, update the LoFi state. | 2275 // If a network request was made, update the LoFi state. |
2275 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2276 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
2276 last_navigation_lofi_state_ = common_params.lofi_state; | 2277 last_navigation_lofi_state_ = common_params.lofi_state; |
2277 | 2278 |
2278 // TODO(clamy): Release the stream handle once the renderer has finished | 2279 // TODO(clamy): Release the stream handle once the renderer has finished |
2279 // reading it. | 2280 // reading it. |
2280 stream_handle_ = std::move(body); | 2281 stream_handle_ = std::move(body); |
2281 | 2282 |
2282 // When navigating to a Javascript url, no commit is expected from the | 2283 // 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... |
2842 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2843 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2843 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2844 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2844 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2845 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2845 } | 2846 } |
2846 | 2847 |
2847 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2848 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2848 web_bluetooth_service_.reset(); | 2849 web_bluetooth_service_.reset(); |
2849 } | 2850 } |
2850 | 2851 |
2851 } // namespace content | 2852 } // namespace content |
OLD | NEW |