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" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/browser/accessibility/accessibility_mode_helper.h" | 18 #include "content/browser/accessibility/accessibility_mode_helper.h" |
19 #include "content/browser/accessibility/ax_tree_id_registry.h" | 19 #include "content/browser/accessibility/ax_tree_id_registry.h" |
20 #include "content/browser/accessibility/browser_accessibility_manager.h" | 20 #include "content/browser/accessibility/browser_accessibility_manager.h" |
21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" | 22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" |
23 #include "content/browser/child_process_security_policy_impl.h" | 23 #include "content/browser/child_process_security_policy_impl.h" |
24 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 24 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
25 #include "content/browser/download/mhtml_generation_manager.h" | 25 #include "content/browser/download/mhtml_generation_manager.h" |
26 #include "content/browser/frame_host/cross_process_frame_connector.h" | 26 #include "content/browser/frame_host/cross_process_frame_connector.h" |
27 #include "content/browser/frame_host/cross_site_transferring_request.h" | |
28 #include "content/browser/frame_host/frame_tree.h" | 27 #include "content/browser/frame_host/frame_tree.h" |
29 #include "content/browser/frame_host/frame_tree_node.h" | 28 #include "content/browser/frame_host/frame_tree_node.h" |
30 #include "content/browser/frame_host/navigation_entry_impl.h" | 29 #include "content/browser/frame_host/navigation_entry_impl.h" |
31 #include "content/browser/frame_host/navigation_handle_impl.h" | 30 #include "content/browser/frame_host/navigation_handle_impl.h" |
32 #include "content/browser/frame_host/navigation_request.h" | 31 #include "content/browser/frame_host/navigation_request.h" |
33 #include "content/browser/frame_host/navigator.h" | 32 #include "content/browser/frame_host/navigator.h" |
34 #include "content/browser/frame_host/navigator_impl.h" | 33 #include "content/browser/frame_host/navigator_impl.h" |
35 #include "content/browser/frame_host/render_frame_host_delegate.h" | 34 #include "content/browser/frame_host/render_frame_host_delegate.h" |
36 #include "content/browser/frame_host/render_frame_proxy_host.h" | 35 #include "content/browser/frame_host/render_frame_proxy_host.h" |
37 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 36 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1288 return GlobalFrameRoutingId(GetProcess()->GetID(), GetRoutingID()); | 1287 return GlobalFrameRoutingId(GetProcess()->GetID(), GetRoutingID()); |
1289 } | 1288 } |
1290 | 1289 |
1291 int RenderFrameHostImpl::GetEnabledBindings() { | 1290 int RenderFrameHostImpl::GetEnabledBindings() { |
1292 return render_view_host_->GetEnabledBindings(); | 1291 return render_view_host_->GetEnabledBindings(); |
1293 } | 1292 } |
1294 | 1293 |
1295 void RenderFrameHostImpl::SetNavigationHandle( | 1294 void RenderFrameHostImpl::SetNavigationHandle( |
1296 std::unique_ptr<NavigationHandleImpl> navigation_handle) { | 1295 std::unique_ptr<NavigationHandleImpl> navigation_handle) { |
1297 navigation_handle_ = std::move(navigation_handle); | 1296 navigation_handle_ = std::move(navigation_handle); |
1298 if (navigation_handle_) | |
1299 navigation_handle_->set_render_frame_host(this); | |
1300 } | 1297 } |
1301 | 1298 |
1302 std::unique_ptr<NavigationHandleImpl> | 1299 std::unique_ptr<NavigationHandleImpl> |
1303 RenderFrameHostImpl::PassNavigationHandleOwnership() { | 1300 RenderFrameHostImpl::PassNavigationHandleOwnership() { |
1304 DCHECK(!IsBrowserSideNavigationEnabled()); | 1301 DCHECK(!IsBrowserSideNavigationEnabled()); |
1305 if (navigation_handle_) | 1302 if (navigation_handle_) |
1306 navigation_handle_->set_is_transferring(true); | 1303 navigation_handle_->set_is_transferring(true); |
1307 return std::move(navigation_handle_); | 1304 return std::move(navigation_handle_); |
1308 } | 1305 } |
1309 | 1306 |
1310 void RenderFrameHostImpl::OnCrossSiteResponse( | |
1311 const GlobalRequestID& global_request_id, | |
1312 std::unique_ptr<CrossSiteTransferringRequest> | |
1313 cross_site_transferring_request, | |
1314 const std::vector<GURL>& transfer_url_chain, | |
1315 const Referrer& referrer, | |
1316 ui::PageTransition page_transition, | |
1317 bool should_replace_current_entry) { | |
1318 frame_tree_node_->render_manager()->OnCrossSiteResponse( | |
1319 this, global_request_id, std::move(cross_site_transferring_request), | |
1320 transfer_url_chain, referrer, page_transition, | |
1321 should_replace_current_entry); | |
1322 } | |
1323 | |
1324 void RenderFrameHostImpl::SwapOut( | 1307 void RenderFrameHostImpl::SwapOut( |
1325 RenderFrameProxyHost* proxy, | 1308 RenderFrameProxyHost* proxy, |
1326 bool is_loading) { | 1309 bool is_loading) { |
1327 // The end of this event is in OnSwapOutACK when the RenderFrame has completed | 1310 // The end of this event is in OnSwapOutACK when the RenderFrame has completed |
1328 // the operation and sends back an IPC message. | 1311 // the operation and sends back an IPC message. |
1329 // The trace event may not end properly if the ACK times out. We expect this | 1312 // The trace event may not end properly if the ACK times out. We expect this |
1330 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. | 1313 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. |
1331 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); | 1314 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); |
1332 | 1315 |
1333 // If this RenderFrameHost is already pending deletion, it must have already | 1316 // If this RenderFrameHost is already pending deletion, it must have already |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2293 // done here either. | 2276 // done here either. |
2294 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 2277 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
2295 OnDidStartLoading(true); | 2278 OnDidStartLoading(true); |
2296 } | 2279 } |
2297 | 2280 |
2298 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2281 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2299 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2282 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2300 CommonNavigationParams common_params( | 2283 CommonNavigationParams common_params( |
2301 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2284 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2302 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2285 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2303 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2286 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
Charlie Reis
2016/09/21 16:47:08
I don't understand this change. Was it wrong befo
clamy
2016/09/22 16:27:23
Are you referring to patchset 9? I tried 2 approac
Charlie Reis
2016/09/23 05:46:55
Oh, I misunderstood! I was looking at the diff to
| |
2304 base::TimeTicks::Now(), "GET", nullptr); | 2287 base::TimeTicks::Now(), "GET", nullptr); |
2305 if (IsBrowserSideNavigationEnabled()) { | 2288 if (IsBrowserSideNavigationEnabled()) { |
2306 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2289 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2307 false); | 2290 false); |
2308 } else { | 2291 } else { |
2309 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2292 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2310 } | 2293 } |
2311 } | 2294 } |
2312 | 2295 |
2313 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 2296 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3093 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3076 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3094 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3077 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3095 return web_bluetooth_service_.get(); | 3078 return web_bluetooth_service_.get(); |
3096 } | 3079 } |
3097 | 3080 |
3098 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3081 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3099 web_bluetooth_service_.reset(); | 3082 web_bluetooth_service_.reset(); |
3100 } | 3083 } |
3101 | 3084 |
3102 } // namespace content | 3085 } // namespace content |
OLD | NEW |