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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 | 987 |
988 void RenderFrameHostImpl::OnDetach() { | 988 void RenderFrameHostImpl::OnDetach() { |
989 frame_tree_->RemoveFrame(frame_tree_node_); | 989 frame_tree_->RemoveFrame(frame_tree_node_); |
990 } | 990 } |
991 | 991 |
992 void RenderFrameHostImpl::OnFrameFocused() { | 992 void RenderFrameHostImpl::OnFrameFocused() { |
993 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); | 993 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); |
994 } | 994 } |
995 | 995 |
996 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { | 996 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { |
| 997 GURL validated_url(params.url); |
| 998 GetProcess()->FilterURL(false, &validated_url); |
| 999 |
997 if (params.is_history_navigation_in_new_child) { | 1000 if (params.is_history_navigation_in_new_child) { |
998 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | 1001 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
999 | 1002 |
1000 // Try to find a FrameNavigationEntry that matches this frame instead, based | 1003 // Try to find a FrameNavigationEntry that matches this frame instead, based |
1001 // on the frame's unique name. If this can't be found, fall back to the | 1004 // on the frame's unique name. If this can't be found, fall back to the |
1002 // default params using OpenURL below. | 1005 // default params using RequestOpenURL below. |
1003 if (frame_tree_node_->navigator()->NavigateNewChildFrame(this, params.url)) | 1006 if (frame_tree_node_->navigator()->NavigateNewChildFrame(this, |
| 1007 validated_url)) |
1004 return; | 1008 return; |
1005 } | 1009 } |
1006 | 1010 |
1007 OpenURL(params, GetSiteInstance()); | 1011 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", |
| 1012 validated_url.possibly_invalid_spec()); |
| 1013 |
| 1014 frame_tree_node_->navigator()->RequestOpenURL( |
| 1015 this, validated_url, params.uses_post, params.resource_request_body, |
| 1016 params.extra_headers, params.referrer, params.disposition, |
| 1017 params.should_replace_current_entry, params.user_gesture); |
1008 } | 1018 } |
1009 | 1019 |
1010 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() { | 1020 void RenderFrameHostImpl::OnCancelInitialHistoryLoad() { |
1011 // A Javascript navigation interrupted the initial history load. Check if an | 1021 // A Javascript navigation interrupted the initial history load. Check if an |
1012 // initial subframe cross-process navigation needs to be canceled as a result. | 1022 // initial subframe cross-process navigation needs to be canceled as a result. |
1013 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate. | 1023 // TODO(creis, clamy): Cancel any cross-process navigation in PlzNavigate. |
1014 if (GetParent() && !frame_tree_node_->has_committed_real_load() && | 1024 if (GetParent() && !frame_tree_node_->has_committed_real_load() && |
1015 frame_tree_node_->render_manager()->pending_frame_host()) { | 1025 frame_tree_node_->render_manager()->pending_frame_host()) { |
1016 frame_tree_node_->render_manager()->CancelPendingIfNecessary( | 1026 frame_tree_node_->render_manager()->CancelPendingIfNecessary( |
1017 frame_tree_node_->render_manager()->pending_frame_host()); | 1027 frame_tree_node_->render_manager()->pending_frame_host()); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2356 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2347 base::TimeTicks::Now(), "GET", nullptr); | 2357 base::TimeTicks::Now(), "GET", nullptr); |
2348 if (IsBrowserSideNavigationEnabled()) { | 2358 if (IsBrowserSideNavigationEnabled()) { |
2349 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2359 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2350 false); | 2360 false); |
2351 } else { | 2361 } else { |
2352 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2362 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2353 } | 2363 } |
2354 } | 2364 } |
2355 | 2365 |
2356 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | |
2357 SiteInstance* source_site_instance) { | |
2358 GURL validated_url(params.url); | |
2359 GetProcess()->FilterURL(false, &validated_url); | |
2360 | |
2361 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OpenURL", "url", | |
2362 validated_url.possibly_invalid_spec()); | |
2363 frame_tree_node_->navigator()->RequestOpenURL( | |
2364 this, validated_url, params.uses_post, params.resource_request_body, | |
2365 params.extra_headers, source_site_instance, params.referrer, | |
2366 params.disposition, params.should_replace_current_entry, | |
2367 params.user_gesture); | |
2368 } | |
2369 | |
2370 void RenderFrameHostImpl::Stop() { | 2366 void RenderFrameHostImpl::Stop() { |
2371 Send(new FrameMsg_Stop(routing_id_)); | 2367 Send(new FrameMsg_Stop(routing_id_)); |
2372 } | 2368 } |
2373 | 2369 |
2374 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, | 2370 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
2375 bool is_reload) { | 2371 bool is_reload) { |
2376 DCHECK(for_navigation || !is_reload); | 2372 DCHECK(for_navigation || !is_reload); |
2377 | 2373 |
2378 if (IsBrowserSideNavigationEnabled() && !for_navigation) { | 2374 if (IsBrowserSideNavigationEnabled() && !for_navigation) { |
2379 // Cancel any pending navigations, to avoid their navigation commit/fail | 2375 // Cancel any pending navigations, to avoid their navigation commit/fail |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3179 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3184 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3180 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3185 return web_bluetooth_service_.get(); | 3181 return web_bluetooth_service_.get(); |
3186 } | 3182 } |
3187 | 3183 |
3188 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3184 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3189 web_bluetooth_service_.reset(); | 3185 web_bluetooth_service_.reset(); |
3190 } | 3186 } |
3191 | 3187 |
3192 } // namespace content | 3188 } // namespace content |
OLD | NEW |