| 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 #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 Loading... |
| 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::FrameHostIPC), |
| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, | 658 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, |
| 671 WebUIJavascriptDisallowedAfterSwapOut); | 659 WebUIJavascriptDisallowedAfterSwapOut); |
| 672 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, LastCommittedOrigin); | 660 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, LastCommittedOrigin); |
| 673 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); | 661 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); |
| 674 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, | 662 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 675 RenderViewHostIsNotReusedAfterDelayedSwapOutACK); | 663 RenderViewHostIsNotReusedAfterDelayedSwapOutACK); |
| 676 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, | 664 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 677 LoadEventForwardingWhilePendingDeletion); | 665 LoadEventForwardingWhilePendingDeletion); |
| 678 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, | 666 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 679 ContextMenuAfterCrossProcessNavigation); | 667 ContextMenuAfterCrossProcessNavigation); |
| 668 FRIEND_TEST_ALL_PREFIXES(SecurityExploitBrowserTest, |
| 669 AttemptDuplicateRenderViewHost); |
| 680 | 670 |
| 681 // IPC Message handlers. | 671 // IPC Message handlers. |
| 682 void OnDidAddMessageToConsole(int32_t level, | 672 void OnDidAddMessageToConsole(int32_t level, |
| 683 const base::string16& message, | 673 const base::string16& message, |
| 684 int32_t line_no, | 674 int32_t line_no, |
| 685 const base::string16& source_id); | 675 const base::string16& source_id); |
| 686 void OnDetach(); | 676 void OnDetach(); |
| 687 void OnFrameFocused(); | 677 void OnFrameFocused(); |
| 688 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); | 678 void OnOpenURL(const FrameHostMsg_OpenURL_Params& params); |
| 689 void OnCancelInitialHistoryLoad(); | 679 void OnCancelInitialHistoryLoad(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 #if defined(OS_ANDROID) | 779 #if defined(OS_ANDROID) |
| 790 void OnNavigationHandledByEmbedder(); | 780 void OnNavigationHandledByEmbedder(); |
| 791 void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, | 781 void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, |
| 792 mojo::ScopedMessagePipeHandle pipe); | 782 mojo::ScopedMessagePipeHandle pipe); |
| 793 #endif | 783 #endif |
| 794 void OnShowCreatedWindow(int pending_widget_routing_id, | 784 void OnShowCreatedWindow(int pending_widget_routing_id, |
| 795 WindowOpenDisposition disposition, | 785 WindowOpenDisposition disposition, |
| 796 const gfx::Rect& initial_rect, | 786 const gfx::Rect& initial_rect, |
| 797 bool user_gesture); | 787 bool user_gesture); |
| 798 | 788 |
| 789 // mojom::FrameHostIPC |
| 790 void CreateNewWindow(mojom::CreateNewWindowParamsPtr params, |
| 791 const CreateNewWindowCallback& callback) override; |
| 792 |
| 793 void RunCreateWindowCompleteCallback(const CreateNewWindowCallback& callback, |
| 794 mojom::CreateNewWindowReplyPtr reply, |
| 795 int render_view_route_id, |
| 796 int main_frame_route_id, |
| 797 int main_frame_widget_route_id, |
| 798 int cloned_session_storage_namespace_id); |
| 799 |
| 799 // Registers Mojo interfaces that this frame host makes available. | 800 // Registers Mojo interfaces that this frame host makes available. |
| 800 void RegisterMojoInterfaces(); | 801 void RegisterMojoInterfaces(); |
| 801 | 802 |
| 802 // Resets any waiting state of this RenderFrameHost that is no longer | 803 // Resets any waiting state of this RenderFrameHost that is no longer |
| 803 // relevant. | 804 // relevant. |
| 804 void ResetWaitingState(); | 805 void ResetWaitingState(); |
| 805 | 806 |
| 806 // Returns whether the given origin is allowed to commit in the current | 807 // Returns whether the given origin is allowed to commit in the current |
| 807 // RenderFrameHost. The |url| is used to ensure it matches the origin in cases | 808 // RenderFrameHost. The |url| is used to ensure it matches the origin in cases |
| 808 // where it is applicable. This is a more conservative check than | 809 // where it is applicable. This is a more conservative check than |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 // such as for a new subframe navigation in a different frame. Tracking this | 1037 // such as for a new subframe navigation in a different frame. Tracking this |
| 1037 // allows us to send things like title and state updates to the latest | 1038 // allows us to send things like title and state updates to the latest |
| 1038 // relevant NavigationEntry. | 1039 // relevant NavigationEntry. |
| 1039 int nav_entry_id_; | 1040 int nav_entry_id_; |
| 1040 | 1041 |
| 1041 // Used to swap out or shut down this RFH when the unload event is taking too | 1042 // Used to swap out or shut down this RFH when the unload event is taking too |
| 1042 // long to execute, depending on the number of active frames in the | 1043 // long to execute, depending on the number of active frames in the |
| 1043 // SiteInstance. May be null in tests. | 1044 // SiteInstance. May be null in tests. |
| 1044 std::unique_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; | 1045 std::unique_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; |
| 1045 | 1046 |
| 1047 std::unique_ptr<AssociatedInterfaceRegistryImpl> associated_registry_; |
| 1048 |
| 1046 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_; | 1049 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_; |
| 1047 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; | 1050 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; |
| 1048 | 1051 |
| 1049 service_manager::ServiceInfo browser_info_; | 1052 service_manager::ServiceInfo browser_info_; |
| 1050 service_manager::ServiceInfo renderer_info_; | 1053 service_manager::ServiceInfo renderer_info_; |
| 1051 | 1054 |
| 1052 int on_connect_handler_id_ = 0; | 1055 int on_connect_handler_id_ = 0; |
| 1053 | 1056 |
| 1054 std::list<std::unique_ptr<WebBluetoothServiceImpl>> web_bluetooth_services_; | 1057 std::list<std::unique_ptr<WebBluetoothServiceImpl>> web_bluetooth_services_; |
| 1055 | 1058 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 | 1126 |
| 1124 // If true, then the RenderFrame has selected text. | 1127 // If true, then the RenderFrame has selected text. |
| 1125 bool has_selection_; | 1128 bool has_selection_; |
| 1126 | 1129 |
| 1127 // PlzNavigate: The Previews state of the last navigation. This is used during | 1130 // PlzNavigate: The Previews state of the last navigation. This is used during |
| 1128 // history navigation of subframes to ensure that subframes navigate with the | 1131 // history navigation of subframes to ensure that subframes navigate with the |
| 1129 // same Previews status as the top-level frame. | 1132 // same Previews status as the top-level frame. |
| 1130 PreviewsState last_navigation_previews_state_; | 1133 PreviewsState last_navigation_previews_state_; |
| 1131 | 1134 |
| 1132 mojo::Binding<mojom::FrameHost> frame_host_binding_; | 1135 mojo::Binding<mojom::FrameHost> frame_host_binding_; |
| 1136 mojo::AssociatedBinding<mojom::FrameHostIPC> frame_host_associated_binding_; |
| 1133 mojom::FramePtr frame_; | 1137 mojom::FramePtr frame_; |
| 1134 mojom::FrameBindingsControlAssociatedPtr frame_bindings_control_; | 1138 mojom::FrameBindingsControlAssociatedPtr frame_bindings_control_; |
| 1135 | 1139 |
| 1136 // If this is true then this object was created in response to a renderer | 1140 // If this is true then this object was created in response to a renderer |
| 1137 // initiated request. Init() will be called, and until then navigation | 1141 // initiated request. Init() will be called, and until then navigation |
| 1138 // requests should be queued. | 1142 // requests should be queued. |
| 1139 bool waiting_for_init_; | 1143 bool waiting_for_init_; |
| 1140 | 1144 |
| 1141 // If true then this frame's document has a focused element which is editable. | 1145 // If true then this frame's document has a focused element which is editable. |
| 1142 bool has_focused_editable_element_; | 1146 bool has_focused_editable_element_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1184 |
| 1181 // NOTE: This must be the last member. | 1185 // NOTE: This must be the last member. |
| 1182 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 1186 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 1183 | 1187 |
| 1184 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 1188 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 1185 }; | 1189 }; |
| 1186 | 1190 |
| 1187 } // namespace content | 1191 } // namespace content |
| 1188 | 1192 |
| 1189 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 1193 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |