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 11 matching lines...) Expand all Loading... |
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/child_process_security_policy_impl.h" | 24 #include "content/browser/child_process_security_policy_impl.h" |
25 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 25 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
26 #include "content/browser/download/mhtml_generation_manager.h" | 26 #include "content/browser/download/mhtml_generation_manager.h" |
27 #include "content/browser/frame_host/cross_process_frame_connector.h" | 27 #include "content/browser/frame_host/cross_process_frame_connector.h" |
28 #include "content/browser/frame_host/cross_site_transferring_request.h" | 28 #include "content/browser/frame_host/cross_site_transferring_request.h" |
29 #include "content/browser/frame_host/frame_mojo_shell.h" | 29 #include "content/browser/frame_host/frame_mojo_shell.h" |
30 #include "content/browser/frame_host/frame_tree.h" | 30 #include "content/browser/frame_host/frame_tree.h" |
31 #include "content/browser/frame_host/frame_tree_node.h" | 31 #include "content/browser/frame_host/frame_tree_node.h" |
| 32 #include "content/browser/frame_host/navigation_entry_impl.h" |
32 #include "content/browser/frame_host/navigation_handle_impl.h" | 33 #include "content/browser/frame_host/navigation_handle_impl.h" |
33 #include "content/browser/frame_host/navigation_request.h" | 34 #include "content/browser/frame_host/navigation_request.h" |
34 #include "content/browser/frame_host/navigator.h" | 35 #include "content/browser/frame_host/navigator.h" |
35 #include "content/browser/frame_host/navigator_impl.h" | 36 #include "content/browser/frame_host/navigator_impl.h" |
36 #include "content/browser/frame_host/render_frame_host_delegate.h" | 37 #include "content/browser/frame_host/render_frame_host_delegate.h" |
37 #include "content/browser/frame_host/render_frame_proxy_host.h" | 38 #include "content/browser/frame_host/render_frame_proxy_host.h" |
38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
39 #include "content/browser/geolocation/geolocation_service_context.h" | 40 #include "content/browser/geolocation/geolocation_service_context.h" |
40 #include "content/browser/host_zoom_map_impl.h" | 41 #include "content/browser/host_zoom_map_impl.h" |
41 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 42 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 // If the URL does not match what the NavigationHandle expects, treat the | 1087 // If the URL does not match what the NavigationHandle expects, treat the |
1087 // commit as a new navigation. This can happen if an ongoing slow | 1088 // commit as a new navigation. This can happen if an ongoing slow |
1088 // same-process navigation is interrupted by a synchronous renderer-initiated | 1089 // same-process navigation is interrupted by a synchronous renderer-initiated |
1089 // navigation. | 1090 // navigation. |
1090 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get | 1091 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get |
1091 // reset here, because the NavigationHandle tracks the URL but the | 1092 // reset here, because the NavigationHandle tracks the URL but the |
1092 // validated_params.url tracks the data. The trick of saving the old entry ids | 1093 // validated_params.url tracks the data. The trick of saving the old entry ids |
1093 // for these navigations should go away when this is properly handled. See | 1094 // for these navigations should go away when this is properly handled. See |
1094 // crbug.com/588317. | 1095 // crbug.com/588317. |
1095 int entry_id_for_data_nav = 0; | 1096 int entry_id_for_data_nav = 0; |
| 1097 bool is_renderer_initiated = true; |
1096 if (navigation_handle_ && | 1098 if (navigation_handle_ && |
1097 (navigation_handle_->GetURL() != validated_params.url)) { | 1099 (navigation_handle_->GetURL() != validated_params.url)) { |
1098 // Make sure that the pending entry was really loaded via | 1100 // Make sure that the pending entry was really loaded via |
1099 // LoadDataWithBaseURL and that it matches this handle. | 1101 // LoadDataWithBaseURL and that it matches this handle. |
1100 NavigationEntry* pending_entry = | 1102 NavigationEntryImpl* pending_entry = |
1101 frame_tree_node()->navigator()->GetController()->GetPendingEntry(); | 1103 NavigationEntryImpl::FromNavigationEntry( |
| 1104 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
1102 bool pending_entry_matches_handle = | 1105 bool pending_entry_matches_handle = |
1103 pending_entry && | 1106 pending_entry && |
1104 pending_entry->GetUniqueID() == | 1107 pending_entry->GetUniqueID() == |
1105 navigation_handle_->pending_nav_entry_id(); | 1108 navigation_handle_->pending_nav_entry_id(); |
1106 // TODO(csharrison): The pending entry's base url should equal | 1109 // TODO(csharrison): The pending entry's base url should equal |
1107 // |validated_params.base_url|. This is not the case for loads with invalid | 1110 // |validated_params.base_url|. This is not the case for loads with invalid |
1108 // base urls. | 1111 // base urls. |
1109 if (navigation_handle_->GetURL() == validated_params.base_url && | 1112 if (navigation_handle_->GetURL() == validated_params.base_url && |
1110 pending_entry_matches_handle && | 1113 pending_entry_matches_handle && |
1111 !pending_entry->GetBaseURLForDataURL().is_empty()) { | 1114 !pending_entry->GetBaseURLForDataURL().is_empty()) { |
1112 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id(); | 1115 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id(); |
| 1116 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
1113 } | 1117 } |
1114 navigation_handle_.reset(); | 1118 navigation_handle_.reset(); |
1115 } | 1119 } |
1116 | 1120 |
1117 // Synchronous renderer-initiated navigations will send a | 1121 // Synchronous renderer-initiated navigations will send a |
1118 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 1122 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
1119 // message. | 1123 // message. |
1120 if (!navigation_handle_) { | 1124 if (!navigation_handle_) { |
1121 // There is no pending NavigationEntry in these cases, so pass 0 as the | 1125 // There is no pending NavigationEntry in these cases, so pass 0 as the |
1122 // nav_id. If the previous handle was a prematurely aborted navigation | 1126 // nav_id. If the previous handle was a prematurely aborted navigation |
1123 // loaded via LoadDataWithBaseURL, propogate the entry id. | 1127 // loaded via LoadDataWithBaseURL, propogate the entry id. |
1124 navigation_handle_ = NavigationHandleImpl::Create( | 1128 navigation_handle_ = NavigationHandleImpl::Create( |
1125 validated_params.url, frame_tree_node_, | 1129 validated_params.url, frame_tree_node_, |
| 1130 is_renderer_initiated, |
1126 true, // is_synchronous | 1131 true, // is_synchronous |
1127 validated_params.is_srcdoc, base::TimeTicks::Now(), | 1132 validated_params.is_srcdoc, base::TimeTicks::Now(), |
1128 entry_id_for_data_nav); | 1133 entry_id_for_data_nav); |
1129 // PlzNavigate | 1134 // PlzNavigate |
1130 if (IsBrowserSideNavigationEnabled()) { | 1135 if (IsBrowserSideNavigationEnabled()) { |
1131 // PlzNavigate: synchronous loads happen in the renderer, and the browser | 1136 // PlzNavigate: synchronous loads happen in the renderer, and the browser |
1132 // has not been notified about the start of the load yet. Do it now. | 1137 // has not been notified about the start of the load yet. Do it now. |
1133 if (!is_loading()) { | 1138 if (!is_loading()) { |
1134 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); | 1139 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); |
1135 is_loading_ = true; | 1140 is_loading_ = true; |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2836 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2841 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2837 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2842 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2838 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2843 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2839 } | 2844 } |
2840 | 2845 |
2841 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2846 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2842 web_bluetooth_service_.reset(); | 2847 web_bluetooth_service_.reset(); |
2843 } | 2848 } |
2844 | 2849 |
2845 } // namespace content | 2850 } // namespace content |
OLD | NEW |