Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2506183002: Make window.open() IPCs be frame-based (Closed)
Patch Set: Compile fix. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
71 #include "content/common/view_messages.h"
alexmos 2016/12/13 18:41:40 Why is this needed?
ncarter (slow) 2016/12/15 00:33:16 Removed. Good catch.
70 #include "content/public/browser/ax_event_notification_details.h" 72 #include "content/public/browser/ax_event_notification_details.h"
71 #include "content/public/browser/browser_accessibility_state.h" 73 #include "content/public/browser/browser_accessibility_state.h"
72 #include "content/public/browser/browser_context.h" 74 #include "content/public/browser/browser_context.h"
73 #include "content/public/browser/browser_plugin_guest_manager.h" 75 #include "content/public/browser/browser_plugin_guest_manager.h"
74 #include "content/public/browser/browser_thread.h" 76 #include "content/public/browser/browser_thread.h"
75 #include "content/public/browser/content_browser_client.h" 77 #include "content/public/browser/content_browser_client.h"
76 #include "content/public/browser/permission_manager.h" 78 #include "content/public/browser/permission_manager.h"
77 #include "content/public/browser/permission_type.h" 79 #include "content/public/browser/permission_type.h"
78 #include "content/public/browser/render_process_host.h" 80 #include "content/public/browser/render_process_host.h"
79 #include "content/public/browser/render_widget_host_view.h" 81 #include "content/public/browser/render_widget_host_view.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) 751 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)
750 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, 752 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress,
751 OnDidChangeLoadProgress) 753 OnDidChangeLoadProgress)
752 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, 754 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse,
753 OnSerializeAsMHTMLResponse) 755 OnSerializeAsMHTMLResponse)
754 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) 756 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged)
755 #if defined(USE_EXTERNAL_POPUP_MENU) 757 #if defined(USE_EXTERNAL_POPUP_MENU)
756 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 758 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
757 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 759 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
758 #endif 760 #endif
761 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow)
759 IPC_END_MESSAGE_MAP() 762 IPC_END_MESSAGE_MAP()
760 763
761 // No further actions here, since we may have been deleted. 764 // No further actions here, since we may have been deleted.
762 return handled; 765 return handled;
763 } 766 }
764 767
765 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( 768 void RenderFrameHostImpl::OnAssociatedInterfaceRequest(
766 const std::string& interface_name, 769 const std::string& interface_name,
767 mojo::ScopedInterfaceEndpointHandle handle) { 770 mojo::ScopedInterfaceEndpointHandle handle) {
768 delegate_->OnAssociatedInterfaceRequest( 771 delegate_->OnAssociatedInterfaceRequest(
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 // frame and it is delivered after this host is swapped out. 1007 // frame and it is delivered after this host is swapped out.
1005 // Ignore such messages, as we know this RenderFrameHost is going away. 1008 // Ignore such messages, as we know this RenderFrameHost is going away.
1006 if (!is_active() || frame_tree_node_->current_frame_host() != this) 1009 if (!is_active() || frame_tree_node_->current_frame_host() != this)
1007 return; 1010 return;
1008 1011
1009 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id, 1012 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id,
1010 scope, frame_name, frame_unique_name, sandbox_flags, 1013 scope, frame_name, frame_unique_name, sandbox_flags,
1011 frame_owner_properties); 1014 frame_owner_properties);
1012 } 1015 }
1013 1016
1017 void RenderFrameHostImpl::OnCreateNewWindow(
1018 int32_t render_view_route_id,
1019 int32_t main_frame_route_id,
1020 int32_t main_frame_widget_route_id,
1021 const mojom::CreateNewWindowParams& params,
1022 SessionStorageNamespace* session_storage_namespace) {
1023 mojom::CreateNewWindowParamsPtr validated_params(params.Clone());
1024 GetProcess()->FilterURL(false, &validated_params->target_url);
1025
1026 // TODO(nick): |opener_url|, |opener_security_origin|, and
1027 // |opener_top_level_frame_url| should not be parameters; we can just use
1028 // last_committed_url(), etc. Of these, |opener_top_level_frame_url| is
1029 // particularly egregious, since an oopif isn't expected to know its top URL.
alexmos 2016/12/13 18:41:40 This cleanup seems important. Is it worth filing
ncarter (slow) 2016/12/15 00:33:16 I've filed a bug. The usage on the IO thread is wh
1030 GetProcess()->FilterURL(false, &validated_params->opener_url);
1031 GetProcess()->FilterURL(true, &validated_params->opener_security_origin);
1032
1033 // Ignore creation when sent from a frame that's not current.
1034 if (frame_tree_node()->current_frame_host() == this) {
alexmos 2016/12/13 18:41:40 Can this be shortened to just is_active()? (That
ncarter (slow) 2016/12/15 00:33:16 Good idea. Done.
1035 delegate_->CreateNewWindow(GetSiteInstance(), render_view_route_id,
1036 main_frame_route_id, main_frame_widget_route_id,
1037 *validated_params, session_storage_namespace);
1038 }
1039
1040 // Our caller (RenderWidgetHelper::OnCreateNewWindowOnUI) will send
1041 // ViewMsg_Close if the above step did not adopt |main_frame_route_id|.
1042 }
1043
1014 void RenderFrameHostImpl::OnDetach() { 1044 void RenderFrameHostImpl::OnDetach() {
1015 frame_tree_->RemoveFrame(frame_tree_node_); 1045 frame_tree_->RemoveFrame(frame_tree_node_);
1016 } 1046 }
1017 1047
1018 void RenderFrameHostImpl::OnFrameFocused() { 1048 void RenderFrameHostImpl::OnFrameFocused() {
1019 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); 1049 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance());
1020 } 1050 }
1021 1051
1022 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { 1052 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) {
1023 GURL validated_url(params.url); 1053 GURL validated_url(params.url);
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 } 2201 }
2172 2202
2173 void RenderFrameHostImpl::OnHidePopup() { 2203 void RenderFrameHostImpl::OnHidePopup() {
2174 RenderViewHostDelegateView* view = 2204 RenderViewHostDelegateView* view =
2175 render_view_host_->delegate_->GetDelegateView(); 2205 render_view_host_->delegate_->GetDelegateView();
2176 if (view) 2206 if (view)
2177 view->HidePopupMenu(); 2207 view->HidePopupMenu();
2178 } 2208 }
2179 #endif 2209 #endif
2180 2210
2211 void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id,
2212 WindowOpenDisposition disposition,
2213 const gfx::Rect& initial_rect,
2214 bool user_gesture) {
2215 delegate_->ShowCreatedWindow(GetProcess()->GetID(), pending_widget_routing_id,
2216 disposition, initial_rect, user_gesture);
2217 }
2218
2181 void RenderFrameHostImpl::RegisterMojoInterfaces() { 2219 void RenderFrameHostImpl::RegisterMojoInterfaces() {
2182 device::GeolocationServiceContext* geolocation_service_context = 2220 device::GeolocationServiceContext* geolocation_service_context =
2183 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; 2221 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL;
2184 if (geolocation_service_context) { 2222 if (geolocation_service_context) {
2185 // TODO(creis): Bind process ID here so that GeolocationServiceImpl 2223 // TODO(creis): Bind process ID here so that GeolocationServiceImpl
2186 // can perform permissions checks once site isolation is complete. 2224 // can perform permissions checks once site isolation is complete.
2187 // crbug.com/426384 2225 // crbug.com/426384
2188 // NOTE: At shutdown, there is no guaranteed ordering between destruction of 2226 // NOTE: At shutdown, there is no guaranteed ordering between destruction of
2189 // this object and destruction of any GeolocationServicesImpls created via 2227 // this object and destruction of any GeolocationServicesImpls created via
2190 // the below service registry, the reason being that the destruction of the 2228 // the below service registry, the reason being that the destruction of the
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3360 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3323 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3361 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3324 return NavigationHandleImpl::Create( 3362 return NavigationHandleImpl::Create(
3325 params.url, frame_tree_node_, is_renderer_initiated, 3363 params.url, frame_tree_node_, is_renderer_initiated,
3326 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), 3364 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(),
3327 entry_id_for_data_nav, params.gesture, 3365 entry_id_for_data_nav, params.gesture,
3328 false); // started_from_context_menu 3366 false); // started_from_context_menu
3329 } 3367 }
3330 3368
3331 } // namespace content 3369 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698