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 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 | 2303 |
2304 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2304 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2305 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2305 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2306 CommonNavigationParams common_params( | 2306 CommonNavigationParams common_params( |
2307 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2307 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2308 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2308 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2309 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2309 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2310 base::TimeTicks::Now(), "GET", nullptr); | 2310 base::TimeTicks::Now(), "GET", nullptr); |
2311 if (IsBrowserSideNavigationEnabled()) { | 2311 if (IsBrowserSideNavigationEnabled()) { |
2312 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2312 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2313 false); | 2313 false, false); |
2314 } else { | 2314 } else { |
2315 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2315 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2316 } | 2316 } |
2317 } | 2317 } |
2318 | 2318 |
2319 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 2319 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
2320 SiteInstance* source_site_instance) { | 2320 SiteInstance* source_site_instance) { |
2321 GURL validated_url(params.url); | 2321 GURL validated_url(params.url); |
2322 GetProcess()->FilterURL(false, &validated_url); | 2322 GetProcess()->FilterURL(false, &validated_url); |
2323 | 2323 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_SUPPRESSED); | 2457 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_SUPPRESSED); |
2458 } | 2458 } |
2459 } | 2459 } |
2460 | 2460 |
2461 // PlzNavigate | 2461 // PlzNavigate |
2462 void RenderFrameHostImpl::CommitNavigation( | 2462 void RenderFrameHostImpl::CommitNavigation( |
2463 ResourceResponse* response, | 2463 ResourceResponse* response, |
2464 std::unique_ptr<StreamHandle> body, | 2464 std::unique_ptr<StreamHandle> body, |
2465 const CommonNavigationParams& common_params, | 2465 const CommonNavigationParams& common_params, |
2466 const RequestNavigationParams& request_params, | 2466 const RequestNavigationParams& request_params, |
2467 bool is_view_source) { | 2467 bool is_view_source, |
| 2468 bool user_gesture) { |
2468 DCHECK((response && body.get()) || | 2469 DCHECK((response && body.get()) || |
2469 common_params.url.SchemeIs(url::kDataScheme) || | 2470 common_params.url.SchemeIs(url::kDataScheme) || |
2470 !ShouldMakeNetworkRequestForURL(common_params.url)); | 2471 !ShouldMakeNetworkRequestForURL(common_params.url)); |
2471 UpdatePermissionsForNavigation(common_params, request_params); | 2472 UpdatePermissionsForNavigation(common_params, request_params); |
2472 | 2473 |
2473 // Get back to a clean state, in case we start a new navigation without | 2474 // Get back to a clean state, in case we start a new navigation without |
2474 // completing an unload handler. | 2475 // completing an unload handler. |
2475 ResetWaitingState(); | 2476 ResetWaitingState(); |
2476 | 2477 |
2477 // The renderer can exit view source mode when any error or cancellation | 2478 // The renderer can exit view source mode when any error or cancellation |
2478 // happen. When reusing the same renderer, overwrite to recover the mode. | 2479 // happen. When reusing the same renderer, overwrite to recover the mode. |
2479 if (is_view_source && | 2480 if (is_view_source && |
2480 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2481 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2481 DCHECK(!GetParent()); | 2482 DCHECK(!GetParent()); |
2482 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2483 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2483 } | 2484 } |
2484 | 2485 |
2485 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2486 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2486 const ResourceResponseHead head = response ? | 2487 const ResourceResponseHead head = response ? |
2487 response->head : ResourceResponseHead(); | 2488 response->head : ResourceResponseHead(); |
2488 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2489 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2489 request_params)); | 2490 request_params, user_gesture)); |
2490 | 2491 |
2491 // If a network request was made, update the LoFi state. | 2492 // If a network request was made, update the LoFi state. |
2492 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2493 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
2493 last_navigation_lofi_state_ = common_params.lofi_state; | 2494 last_navigation_lofi_state_ = common_params.lofi_state; |
2494 | 2495 |
2495 // TODO(clamy): Release the stream handle once the renderer has finished | 2496 // TODO(clamy): Release the stream handle once the renderer has finished |
2496 // reading it. | 2497 // reading it. |
2497 stream_handle_ = std::move(body); | 2498 stream_handle_ = std::move(body); |
2498 | 2499 |
2499 // When navigating to a Javascript url, no commit is expected from the | 2500 // When navigating to a Javascript url, no commit is expected from the |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3100 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3100 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3101 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3101 return web_bluetooth_service_.get(); | 3102 return web_bluetooth_service_.get(); |
3102 } | 3103 } |
3103 | 3104 |
3104 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3105 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3105 web_bluetooth_service_.reset(); | 3106 web_bluetooth_service_.reset(); |
3106 } | 3107 } |
3107 | 3108 |
3108 } // namespace content | 3109 } // namespace content |
OLD | NEW |