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

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

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: MakeShared goodness Created 3 years, 8 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
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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 class WebBluetoothService; 76 class WebBluetoothService;
77 } 77 }
78 } 78 }
79 79
80 namespace gfx { 80 namespace gfx {
81 class Range; 81 class Range;
82 } 82 }
83 83
84 namespace content { 84 namespace content {
85 class AssociatedInterfaceProviderImpl; 85 class AssociatedInterfaceProviderImpl;
86 class AssociatedInterfaceRegistryImpl;
86 class FeaturePolicy; 87 class FeaturePolicy;
87 class FrameTree; 88 class FrameTree;
88 class FrameTreeNode; 89 class FrameTreeNode;
89 class MediaInterfaceProxy; 90 class MediaInterfaceProxy;
90 class NavigationHandleImpl; 91 class NavigationHandleImpl;
91 class PermissionServiceContext; 92 class PermissionServiceContext;
92 class RenderFrameHostDelegate; 93 class RenderFrameHostDelegate;
93 class RenderFrameProxyHost; 94 class RenderFrameProxyHost;
94 class RenderProcessHost; 95 class RenderProcessHost;
95 class RenderViewHostImpl; 96 class RenderViewHostImpl;
96 class RenderWidgetHostDelegate; 97 class RenderWidgetHostDelegate;
97 class RenderWidgetHostImpl; 98 class RenderWidgetHostImpl;
98 class RenderWidgetHostView; 99 class RenderWidgetHostView;
99 class RenderWidgetHostViewBase; 100 class RenderWidgetHostViewBase;
100 class ResourceRequestBody; 101 class ResourceRequestBody;
101 class StreamHandle; 102 class StreamHandle;
102 class TimeoutMonitor; 103 class TimeoutMonitor;
103 class WebBluetoothServiceImpl; 104 class WebBluetoothServiceImpl;
104 struct ContextMenuParams; 105 struct ContextMenuParams;
105 struct FileChooserParams; 106 struct FileChooserParams;
106 struct FrameOwnerProperties; 107 struct FrameOwnerProperties;
107 struct FileChooserParams; 108 struct FileChooserParams;
108 struct ResourceResponse; 109 struct ResourceResponse;
109 110
110 namespace mojom {
111 class CreateNewWindowParams;
112 }
113
114 class CONTENT_EXPORT RenderFrameHostImpl 111 class CONTENT_EXPORT RenderFrameHostImpl
115 : public RenderFrameHost, 112 : public RenderFrameHost,
116 public base::SupportsUserData, 113 public base::SupportsUserData,
117 NON_EXPORTED_BASE(public mojom::FrameHost), 114 NON_EXPORTED_BASE(public mojom::FrameHost),
115 NON_EXPORTED_BASE(public mojom::FrameHostInterfaceBroker),
118 public BrowserAccessibilityDelegate, 116 public BrowserAccessibilityDelegate,
119 public SiteInstanceImpl::Observer, 117 public SiteInstanceImpl::Observer,
120 public NON_EXPORTED_BASE( 118 public NON_EXPORTED_BASE(
121 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>), 119 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>),
122 public CSPContext { 120 public CSPContext {
123 public: 121 public:
124 using AXTreeSnapshotCallback = 122 using AXTreeSnapshotCallback =
125 base::Callback<void( 123 base::Callback<void(
126 const ui::AXTreeUpdate&)>; 124 const ui::AXTreeUpdate&)>;
127 using SmartClipCallback = base::Callback<void(const base::string16& text, 125 using SmartClipCallback = base::Callback<void(const base::string16& text,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 const TextSurroundingSelectionCallback& callback, 182 const TextSurroundingSelectionCallback& callback,
185 int max_length) override; 183 int max_length) override;
186 void AllowBindings(int binding_flags) override; 184 void AllowBindings(int binding_flags) override;
187 int GetEnabledBindings() const override; 185 int GetEnabledBindings() const override;
188 void BlockRequestsForFrame() override; 186 void BlockRequestsForFrame() override;
189 void ResumeBlockedRequestsForFrame() override; 187 void ResumeBlockedRequestsForFrame() override;
190 void DisableBeforeUnloadHangMonitorForTesting() override; 188 void DisableBeforeUnloadHangMonitorForTesting() override;
191 bool IsBeforeUnloadHangMonitorDisabledForTesting() override; 189 bool IsBeforeUnloadHangMonitorDisabledForTesting() override;
192 bool IsFeatureEnabled(blink::WebFeaturePolicyFeature feature) override; 190 bool IsFeatureEnabled(blink::WebFeaturePolicyFeature feature) override;
193 191
194 // mojom::FrameHost 192 // mojom::FrameHostInterfaceBroker
195 void GetInterfaceProvider( 193 void GetInterfaceProvider(
196 service_manager::mojom::InterfaceProviderRequest interfaces) override; 194 service_manager::mojom::InterfaceProviderRequest interfaces) override;
197 195
198 // IPC::Sender 196 // IPC::Sender
199 bool Send(IPC::Message* msg) override; 197 bool Send(IPC::Message* msg) override;
200 198
201 // IPC::Listener 199 // IPC::Listener
202 bool OnMessageReceived(const IPC::Message& msg) override; 200 bool OnMessageReceived(const IPC::Message& msg) override;
203 void OnAssociatedInterfaceRequest( 201 void OnAssociatedInterfaceRequest(
204 const std::string& interface_name, 202 const std::string& interface_name,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // and is forwarded here. The renderer has already been told to create a 243 // and is forwarded here. The renderer has already been told to create a
246 // RenderFrame with |new_routing_id|. 244 // RenderFrame with |new_routing_id|.
247 void OnCreateChildFrame(int new_routing_id, 245 void OnCreateChildFrame(int new_routing_id,
248 blink::WebTreeScopeType scope, 246 blink::WebTreeScopeType scope,
249 const std::string& frame_name, 247 const std::string& frame_name,
250 const std::string& frame_unique_name, 248 const std::string& frame_unique_name,
251 blink::WebSandboxFlags sandbox_flags, 249 blink::WebSandboxFlags sandbox_flags,
252 const ParsedFeaturePolicyHeader& container_policy, 250 const ParsedFeaturePolicyHeader& container_policy,
253 const FrameOwnerProperties& frame_owner_properties); 251 const FrameOwnerProperties& frame_owner_properties);
254 252
255 // Called when this frame tries to open a new WebContents, e.g. via a script
256 // call to window.open(). The renderer has already been told to create the
257 // RenderView and RenderFrame with the specified route ids, which were
258 // assigned on the IO thread.
259 void OnCreateNewWindow(int32_t render_view_route_id,
260 int32_t main_frame_route_id,
261 int32_t main_frame_widget_route_id,
262 const mojom::CreateNewWindowParams& params,
263 SessionStorageNamespace* session_storage_namespace);
264
265 // Update this frame's last committed origin. 253 // Update this frame's last committed origin.
266 void SetLastCommittedOrigin(const url::Origin& origin); 254 void SetLastCommittedOrigin(const url::Origin& origin);
267 255
268 RenderViewHostImpl* render_view_host() { return render_view_host_; } 256 RenderViewHostImpl* render_view_host() { return render_view_host_; }
269 RenderFrameHostDelegate* delegate() { return delegate_; } 257 RenderFrameHostDelegate* delegate() { return delegate_; }
270 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 258 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
271 259
272 const GURL& last_committed_url() const { return last_committed_url_; } 260 const GURL& last_committed_url() const { return last_committed_url_; }
273 261
274 // Allows FrameTreeNode::SetCurrentURL to update this frame's last committed 262 // Allows FrameTreeNode::SetCurrentURL to update this frame's last committed
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, 659 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest,
672 WebUIJavascriptDisallowedAfterSwapOut); 660 WebUIJavascriptDisallowedAfterSwapOut);
673 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, LastCommittedOrigin); 661 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, LastCommittedOrigin);
674 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); 662 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe);
675 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, 663 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
676 RenderViewHostIsNotReusedAfterDelayedSwapOutACK); 664 RenderViewHostIsNotReusedAfterDelayedSwapOutACK);
677 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, 665 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
678 LoadEventForwardingWhilePendingDeletion); 666 LoadEventForwardingWhilePendingDeletion);
679 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, 667 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
680 ContextMenuAfterCrossProcessNavigation); 668 ContextMenuAfterCrossProcessNavigation);
669 FRIEND_TEST_ALL_PREFIXES(SecurityExploitBrowserTest,
670 AttemptDuplicateRenderViewHost);
681 671
682 // IPC Message handlers. 672 // IPC Message handlers.
683 void OnDidAddMessageToConsole(int32_t level, 673 void OnDidAddMessageToConsole(int32_t level,
684 const base::string16& message, 674 const base::string16& message,
685 int32_t line_no, 675 int32_t line_no,
686 const base::string16& source_id); 676 const base::string16& source_id);
687 void OnDetach(); 677 void OnDetach();
688 void OnFrameFocused(); 678 void OnFrameFocused();
689 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); 679 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params);
690 void OnCancelInitialHistoryLoad(); 680 void OnCancelInitialHistoryLoad();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 #if defined(OS_ANDROID) 780 #if defined(OS_ANDROID)
791 void OnNavigationHandledByEmbedder(); 781 void OnNavigationHandledByEmbedder();
792 void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, 782 void ForwardGetInterfaceToRenderFrame(const std::string& interface_name,
793 mojo::ScopedMessagePipeHandle pipe); 783 mojo::ScopedMessagePipeHandle pipe);
794 #endif 784 #endif
795 void OnShowCreatedWindow(int pending_widget_routing_id, 785 void OnShowCreatedWindow(int pending_widget_routing_id,
796 WindowOpenDisposition disposition, 786 WindowOpenDisposition disposition,
797 const gfx::Rect& initial_rect, 787 const gfx::Rect& initial_rect,
798 bool user_gesture); 788 bool user_gesture);
799 789
790 // mojom::FrameHost
791 void CreateNewWindow(mojom::CreateNewWindowParamsPtr params,
792 const CreateNewWindowCallback& callback) override;
793
794 void RunCreateWindowCompleteCallback(const CreateNewWindowCallback& callback,
795 mojom::CreateNewWindowReplyPtr reply,
796 int render_view_route_id,
797 int main_frame_route_id,
798 int main_frame_widget_route_id,
799 int cloned_session_storage_namespace_id);
800
800 // Registers Mojo interfaces that this frame host makes available. 801 // Registers Mojo interfaces that this frame host makes available.
801 void RegisterMojoInterfaces(); 802 void RegisterMojoInterfaces();
802 803
803 // Resets any waiting state of this RenderFrameHost that is no longer 804 // Resets any waiting state of this RenderFrameHost that is no longer
804 // relevant. 805 // relevant.
805 void ResetWaitingState(); 806 void ResetWaitingState();
806 807
807 // Returns whether the given origin is allowed to commit in the current 808 // Returns whether the given origin is allowed to commit in the current
808 // RenderFrameHost. The |url| is used to ensure it matches the origin in cases 809 // RenderFrameHost. The |url| is used to ensure it matches the origin in cases
809 // where it is applicable. This is a more conservative check than 810 // where it is applicable. This is a more conservative check than
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // such as for a new subframe navigation in a different frame. Tracking this 1038 // such as for a new subframe navigation in a different frame. Tracking this
1038 // allows us to send things like title and state updates to the latest 1039 // allows us to send things like title and state updates to the latest
1039 // relevant NavigationEntry. 1040 // relevant NavigationEntry.
1040 int nav_entry_id_; 1041 int nav_entry_id_;
1041 1042
1042 // Used to swap out or shut down this RFH when the unload event is taking too 1043 // Used to swap out or shut down this RFH when the unload event is taking too
1043 // long to execute, depending on the number of active frames in the 1044 // long to execute, depending on the number of active frames in the
1044 // SiteInstance. May be null in tests. 1045 // SiteInstance. May be null in tests.
1045 std::unique_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 1046 std::unique_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
1046 1047
1048 std::unique_ptr<AssociatedInterfaceRegistryImpl> associated_registry_;
1049
1047 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_; 1050 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
1048 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; 1051 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
1049 1052
1050 service_manager::ServiceInfo browser_info_; 1053 service_manager::ServiceInfo browser_info_;
1051 service_manager::ServiceInfo renderer_info_; 1054 service_manager::ServiceInfo renderer_info_;
1052 1055
1053 int on_connect_handler_id_ = 0; 1056 int on_connect_handler_id_ = 0;
1054 1057
1055 std::list<std::unique_ptr<WebBluetoothServiceImpl>> web_bluetooth_services_; 1058 std::list<std::unique_ptr<WebBluetoothServiceImpl>> web_bluetooth_services_;
1056 1059
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 bool should_reuse_web_ui_; 1126 bool should_reuse_web_ui_;
1124 1127
1125 // If true, then the RenderFrame has selected text. 1128 // If true, then the RenderFrame has selected text.
1126 bool has_selection_; 1129 bool has_selection_;
1127 1130
1128 // PlzNavigate: The Previews state of the last navigation. This is used during 1131 // PlzNavigate: The Previews state of the last navigation. This is used during
1129 // history navigation of subframes to ensure that subframes navigate with the 1132 // history navigation of subframes to ensure that subframes navigate with the
1130 // same Previews status as the top-level frame. 1133 // same Previews status as the top-level frame.
1131 PreviewsState last_navigation_previews_state_; 1134 PreviewsState last_navigation_previews_state_;
1132 1135
1133 mojo::Binding<mojom::FrameHost> frame_host_binding_; 1136 mojo::Binding<mojom::FrameHostInterfaceBroker>
1137 frame_host_interface_broker_binding_;
1138 mojo::AssociatedBinding<mojom::FrameHost> frame_host_associated_binding_;
1134 mojom::FramePtr frame_; 1139 mojom::FramePtr frame_;
1135 mojom::FrameBindingsControlAssociatedPtr frame_bindings_control_; 1140 mojom::FrameBindingsControlAssociatedPtr frame_bindings_control_;
1136 1141
1137 // If this is true then this object was created in response to a renderer 1142 // If this is true then this object was created in response to a renderer
1138 // initiated request. Init() will be called, and until then navigation 1143 // initiated request. Init() will be called, and until then navigation
1139 // requests should be queued. 1144 // requests should be queued.
1140 bool waiting_for_init_; 1145 bool waiting_for_init_;
1141 1146
1142 // If true then this frame's document has a focused element which is editable. 1147 // If true then this frame's document has a focused element which is editable.
1143 bool has_focused_editable_element_; 1148 bool has_focused_editable_element_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 1186
1182 // NOTE: This must be the last member. 1187 // NOTE: This must be the last member.
1183 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 1188 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
1184 1189
1185 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 1190 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
1186 }; 1191 };
1187 1192
1188 } // namespace content 1193 } // namespace content
1189 1194
1190 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 1195 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698