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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "content/browser/websockets/websocket_manager.h" | 57 #include "content/browser/websockets/websocket_manager.h" |
58 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 58 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
59 #include "content/common/accessibility_messages.h" | 59 #include "content/common/accessibility_messages.h" |
60 #include "content/common/associated_interface_provider_impl.h" | 60 #include "content/common/associated_interface_provider_impl.h" |
61 #include "content/common/associated_interfaces.mojom.h" | 61 #include "content/common/associated_interfaces.mojom.h" |
62 #include "content/common/frame_messages.h" | 62 #include "content/common/frame_messages.h" |
63 #include "content/common/frame_owner_properties.h" | 63 #include "content/common/frame_owner_properties.h" |
64 #include "content/common/input_messages.h" | 64 #include "content/common/input_messages.h" |
65 #include "content/common/inter_process_time_ticks_converter.h" | 65 #include "content/common/inter_process_time_ticks_converter.h" |
66 #include "content/common/navigation_params.h" | 66 #include "content/common/navigation_params.h" |
| 67 #include "content/common/render_message_filter.mojom.h" |
67 #include "content/common/renderer.mojom.h" | 68 #include "content/common/renderer.mojom.h" |
68 #include "content/common/site_isolation_policy.h" | 69 #include "content/common/site_isolation_policy.h" |
69 #include "content/common/swapped_out_messages.h" | 70 #include "content/common/swapped_out_messages.h" |
70 #include "content/public/browser/ax_event_notification_details.h" | 71 #include "content/public/browser/ax_event_notification_details.h" |
71 #include "content/public/browser/browser_accessibility_state.h" | 72 #include "content/public/browser/browser_accessibility_state.h" |
72 #include "content/public/browser/browser_context.h" | 73 #include "content/public/browser/browser_context.h" |
73 #include "content/public/browser/browser_plugin_guest_manager.h" | 74 #include "content/public/browser/browser_plugin_guest_manager.h" |
74 #include "content/public/browser/browser_thread.h" | 75 #include "content/public/browser/browser_thread.h" |
75 #include "content/public/browser/content_browser_client.h" | 76 #include "content/public/browser/content_browser_client.h" |
76 #include "content/public/browser/permission_manager.h" | 77 #include "content/public/browser/permission_manager.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 750 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
750 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 751 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
751 OnDidChangeLoadProgress) | 752 OnDidChangeLoadProgress) |
752 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, | 753 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, |
753 OnSerializeAsMHTMLResponse) | 754 OnSerializeAsMHTMLResponse) |
754 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) | 755 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) |
755 #if defined(USE_EXTERNAL_POPUP_MENU) | 756 #if defined(USE_EXTERNAL_POPUP_MENU) |
756 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 757 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
757 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 758 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
758 #endif | 759 #endif |
| 760 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) |
759 IPC_END_MESSAGE_MAP() | 761 IPC_END_MESSAGE_MAP() |
760 | 762 |
761 // No further actions here, since we may have been deleted. | 763 // No further actions here, since we may have been deleted. |
762 return handled; | 764 return handled; |
763 } | 765 } |
764 | 766 |
765 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( | 767 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( |
766 const std::string& interface_name, | 768 const std::string& interface_name, |
767 mojo::ScopedInterfaceEndpointHandle handle) { | 769 mojo::ScopedInterfaceEndpointHandle handle) { |
768 delegate_->OnAssociatedInterfaceRequest( | 770 delegate_->OnAssociatedInterfaceRequest( |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 // frame and it is delivered after this host is swapped out. | 1006 // frame and it is delivered after this host is swapped out. |
1005 // Ignore such messages, as we know this RenderFrameHost is going away. | 1007 // Ignore such messages, as we know this RenderFrameHost is going away. |
1006 if (!is_active() || frame_tree_node_->current_frame_host() != this) | 1008 if (!is_active() || frame_tree_node_->current_frame_host() != this) |
1007 return; | 1009 return; |
1008 | 1010 |
1009 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id, | 1011 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id, |
1010 scope, frame_name, frame_unique_name, sandbox_flags, | 1012 scope, frame_name, frame_unique_name, sandbox_flags, |
1011 frame_owner_properties); | 1013 frame_owner_properties); |
1012 } | 1014 } |
1013 | 1015 |
| 1016 void RenderFrameHostImpl::OnCreateNewWindow( |
| 1017 int32_t render_view_route_id, |
| 1018 int32_t main_frame_route_id, |
| 1019 int32_t main_frame_widget_route_id, |
| 1020 const mojom::CreateNewWindowParams& params, |
| 1021 SessionStorageNamespace* session_storage_namespace) { |
| 1022 mojom::CreateNewWindowParamsPtr validated_params(params.Clone()); |
| 1023 GetProcess()->FilterURL(false, &validated_params->target_url); |
| 1024 |
| 1025 // TODO(nick): http://crbug.com/674307 |opener_url|, |opener_security_origin|, |
| 1026 // and |opener_top_level_frame_url| should not be parameters; we can just use |
| 1027 // last_committed_url(), etc. Of these, |opener_top_level_frame_url| is |
| 1028 // particularly egregious, since an oopif isn't expected to know its top URL. |
| 1029 GetProcess()->FilterURL(false, &validated_params->opener_url); |
| 1030 GetProcess()->FilterURL(true, &validated_params->opener_security_origin); |
| 1031 |
| 1032 // Ignore creation when sent from a frame that's not current. |
| 1033 if (is_active()) { |
| 1034 delegate_->CreateNewWindow(GetSiteInstance(), render_view_route_id, |
| 1035 main_frame_route_id, main_frame_widget_route_id, |
| 1036 *validated_params, session_storage_namespace); |
| 1037 } |
| 1038 |
| 1039 // Our caller (RenderWidgetHelper::OnCreateNewWindowOnUI) will send |
| 1040 // ViewMsg_Close if the above step did not adopt |main_frame_route_id|. |
| 1041 } |
| 1042 |
1014 void RenderFrameHostImpl::OnDetach() { | 1043 void RenderFrameHostImpl::OnDetach() { |
1015 frame_tree_->RemoveFrame(frame_tree_node_); | 1044 frame_tree_->RemoveFrame(frame_tree_node_); |
1016 } | 1045 } |
1017 | 1046 |
1018 void RenderFrameHostImpl::OnFrameFocused() { | 1047 void RenderFrameHostImpl::OnFrameFocused() { |
1019 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); | 1048 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); |
1020 } | 1049 } |
1021 | 1050 |
1022 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { | 1051 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { |
1023 GURL validated_url(params.url); | 1052 GURL validated_url(params.url); |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 } | 2200 } |
2172 | 2201 |
2173 void RenderFrameHostImpl::OnHidePopup() { | 2202 void RenderFrameHostImpl::OnHidePopup() { |
2174 RenderViewHostDelegateView* view = | 2203 RenderViewHostDelegateView* view = |
2175 render_view_host_->delegate_->GetDelegateView(); | 2204 render_view_host_->delegate_->GetDelegateView(); |
2176 if (view) | 2205 if (view) |
2177 view->HidePopupMenu(); | 2206 view->HidePopupMenu(); |
2178 } | 2207 } |
2179 #endif | 2208 #endif |
2180 | 2209 |
| 2210 void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id, |
| 2211 WindowOpenDisposition disposition, |
| 2212 const gfx::Rect& initial_rect, |
| 2213 bool user_gesture) { |
| 2214 delegate_->ShowCreatedWindow(GetProcess()->GetID(), pending_widget_routing_id, |
| 2215 disposition, initial_rect, user_gesture); |
| 2216 } |
| 2217 |
2181 void RenderFrameHostImpl::RegisterMojoInterfaces() { | 2218 void RenderFrameHostImpl::RegisterMojoInterfaces() { |
2182 device::GeolocationServiceContext* geolocation_service_context = | 2219 device::GeolocationServiceContext* geolocation_service_context = |
2183 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 2220 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
2184 if (geolocation_service_context) { | 2221 if (geolocation_service_context) { |
2185 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 2222 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
2186 // can perform permissions checks once site isolation is complete. | 2223 // can perform permissions checks once site isolation is complete. |
2187 // crbug.com/426384 | 2224 // crbug.com/426384 |
2188 // NOTE: At shutdown, there is no guaranteed ordering between destruction of | 2225 // NOTE: At shutdown, there is no guaranteed ordering between destruction of |
2189 // this object and destruction of any GeolocationServicesImpls created via | 2226 // this object and destruction of any GeolocationServicesImpls created via |
2190 // the below service registry, the reason being that the destruction of the | 2227 // the below service registry, the reason being that the destruction of the |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3359 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3323 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3360 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3324 return NavigationHandleImpl::Create( | 3361 return NavigationHandleImpl::Create( |
3325 params.url, frame_tree_node_, is_renderer_initiated, | 3362 params.url, frame_tree_node_, is_renderer_initiated, |
3326 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3363 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
3327 entry_id_for_data_nav, params.gesture, | 3364 entry_id_for_data_nav, params.gesture, |
3328 false); // started_from_context_menu | 3365 false); // started_from_context_menu |
3329 } | 3366 } |
3330 | 3367 |
3331 } // namespace content | 3368 } // namespace content |
OLD | NEW |