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

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: Rebase. Created 3 years, 11 months 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.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"
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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, 754 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress,
754 OnDidChangeLoadProgress) 755 OnDidChangeLoadProgress)
755 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, 756 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse,
756 OnSerializeAsMHTMLResponse) 757 OnSerializeAsMHTMLResponse)
757 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) 758 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged)
758 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) 759 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedNodeChanged, OnFocusedNodeChanged)
759 #if defined(USE_EXTERNAL_POPUP_MENU) 760 #if defined(USE_EXTERNAL_POPUP_MENU)
760 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 761 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
761 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 762 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
762 #endif 763 #endif
764 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow)
763 IPC_END_MESSAGE_MAP() 765 IPC_END_MESSAGE_MAP()
764 766
765 // No further actions here, since we may have been deleted. 767 // No further actions here, since we may have been deleted.
766 return handled; 768 return handled;
767 } 769 }
768 770
769 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( 771 void RenderFrameHostImpl::OnAssociatedInterfaceRequest(
770 const std::string& interface_name, 772 const std::string& interface_name,
771 mojo::ScopedInterfaceEndpointHandle handle) { 773 mojo::ScopedInterfaceEndpointHandle handle) {
772 delegate_->OnAssociatedInterfaceRequest( 774 delegate_->OnAssociatedInterfaceRequest(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 // frame and it is delivered after this host is swapped out. 1016 // frame and it is delivered after this host is swapped out.
1015 // Ignore such messages, as we know this RenderFrameHost is going away. 1017 // Ignore such messages, as we know this RenderFrameHost is going away.
1016 if (!is_active() || frame_tree_node_->current_frame_host() != this) 1018 if (!is_active() || frame_tree_node_->current_frame_host() != this)
1017 return; 1019 return;
1018 1020
1019 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id, 1021 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id,
1020 scope, frame_name, frame_unique_name, sandbox_flags, 1022 scope, frame_name, frame_unique_name, sandbox_flags,
1021 frame_owner_properties); 1023 frame_owner_properties);
1022 } 1024 }
1023 1025
1026 void RenderFrameHostImpl::OnCreateNewWindow(
1027 int32_t render_view_route_id,
1028 int32_t main_frame_route_id,
1029 int32_t main_frame_widget_route_id,
1030 const mojom::CreateNewWindowParams& params,
1031 SessionStorageNamespace* session_storage_namespace) {
1032 mojom::CreateNewWindowParamsPtr validated_params(params.Clone());
1033 GetProcess()->FilterURL(false, &validated_params->target_url);
1034
1035 // TODO(nick): http://crbug.com/674307 |opener_url|, |opener_security_origin|,
1036 // and |opener_top_level_frame_url| should not be parameters; we can just use
1037 // last_committed_url(), etc. Of these, |opener_top_level_frame_url| is
1038 // particularly egregious, since an oopif isn't expected to know its top URL.
1039 GetProcess()->FilterURL(false, &validated_params->opener_url);
1040 GetProcess()->FilterURL(true, &validated_params->opener_security_origin);
1041
1042 // Ignore creation when sent from a frame that's not current.
1043 if (frame_tree_node_->current_frame_host() == this) {
1044 delegate_->CreateNewWindow(GetSiteInstance(), render_view_route_id,
1045 main_frame_route_id, main_frame_widget_route_id,
1046 *validated_params, session_storage_namespace);
1047 }
1048
1049 // Our caller (RenderWidgetHelper::OnCreateNewWindowOnUI) will send
1050 // ViewMsg_Close if the above step did not adopt |main_frame_route_id|.
1051 }
1052
1024 void RenderFrameHostImpl::OnDetach() { 1053 void RenderFrameHostImpl::OnDetach() {
1025 frame_tree_->RemoveFrame(frame_tree_node_); 1054 frame_tree_->RemoveFrame(frame_tree_node_);
1026 } 1055 }
1027 1056
1028 void RenderFrameHostImpl::OnFrameFocused() { 1057 void RenderFrameHostImpl::OnFrameFocused() {
1029 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance()); 1058 delegate_->SetFocusedFrame(frame_tree_node_, GetSiteInstance());
1030 } 1059 }
1031 1060
1032 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) { 1061 void RenderFrameHostImpl::OnOpenURL(const FrameHostMsg_OpenURL_Params& params) {
1033 GURL validated_url(params.url); 1062 GURL validated_url(params.url);
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 } 2213 }
2185 2214
2186 void RenderFrameHostImpl::OnHidePopup() { 2215 void RenderFrameHostImpl::OnHidePopup() {
2187 RenderViewHostDelegateView* view = 2216 RenderViewHostDelegateView* view =
2188 render_view_host_->delegate_->GetDelegateView(); 2217 render_view_host_->delegate_->GetDelegateView();
2189 if (view) 2218 if (view)
2190 view->HidePopupMenu(); 2219 view->HidePopupMenu();
2191 } 2220 }
2192 #endif 2221 #endif
2193 2222
2223 void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id,
2224 WindowOpenDisposition disposition,
2225 const gfx::Rect& initial_rect,
2226 bool user_gesture) {
2227 delegate_->ShowCreatedWindow(GetProcess()->GetID(), pending_widget_routing_id,
2228 disposition, initial_rect, user_gesture);
2229 }
2230
2194 void RenderFrameHostImpl::RegisterMojoInterfaces() { 2231 void RenderFrameHostImpl::RegisterMojoInterfaces() {
2195 device::GeolocationServiceContext* geolocation_service_context = 2232 device::GeolocationServiceContext* geolocation_service_context =
2196 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; 2233 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL;
2197 if (geolocation_service_context) { 2234 if (geolocation_service_context) {
2198 // TODO(creis): Bind process ID here so that GeolocationServiceImpl 2235 // TODO(creis): Bind process ID here so that GeolocationServiceImpl
2199 // can perform permissions checks once site isolation is complete. 2236 // can perform permissions checks once site isolation is complete.
2200 // crbug.com/426384 2237 // crbug.com/426384
2201 // NOTE: At shutdown, there is no guaranteed ordering between destruction of 2238 // NOTE: At shutdown, there is no guaranteed ordering between destruction of
2202 // this object and destruction of any GeolocationServicesImpls created via 2239 // this object and destruction of any GeolocationServicesImpls created via
2203 // the below service registry, the reason being that the destruction of the 2240 // the below service registry, the reason being that the destruction of the
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 // There is no pending NavigationEntry in these cases, so pass 0 as the 3384 // There is no pending NavigationEntry in these cases, so pass 0 as the
3348 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3385 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3349 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3386 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3350 return NavigationHandleImpl::Create( 3387 return NavigationHandleImpl::Create(
3351 params.url, frame_tree_node_, is_renderer_initiated, 3388 params.url, frame_tree_node_, is_renderer_initiated,
3352 params.was_within_same_page, base::TimeTicks::Now(), 3389 params.was_within_same_page, base::TimeTicks::Now(),
3353 entry_id_for_data_nav, false); // started_from_context_menu 3390 entry_id_for_data_nav, false); // started_from_context_menu
3354 } 3391 }
3355 3392
3356 } // namespace content 3393 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698