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