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 11 matching lines...) Expand all Loading... |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/browser/accessibility/browser_accessibility_manager.h" | 24 #include "content/browser/accessibility/browser_accessibility_manager.h" |
25 #include "content/browser/bad_message.h" | 25 #include "content/browser/bad_message.h" |
26 #include "content/browser/loader/global_routing_id.h" | 26 #include "content/browser/loader/global_routing_id.h" |
27 #include "content/browser/site_instance_impl.h" | 27 #include "content/browser/site_instance_impl.h" |
28 #include "content/browser/webui/web_ui_impl.h" | 28 #include "content/browser/webui/web_ui_impl.h" |
29 #include "content/common/accessibility_mode_enums.h" | 29 #include "content/common/accessibility_mode_enums.h" |
30 #include "content/common/ax_content_node_data.h" | 30 #include "content/common/ax_content_node_data.h" |
31 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
| 32 #include "content/common/frame_host.mojom.h" |
32 #include "content/common/frame_message_enums.h" | 33 #include "content/common/frame_message_enums.h" |
33 #include "content/common/frame_replication_state.h" | 34 #include "content/common/frame_replication_state.h" |
34 #include "content/common/image_downloader/image_downloader.mojom.h" | 35 #include "content/common/image_downloader/image_downloader.mojom.h" |
35 #include "content/common/mojo/service_registry_impl.h" | 36 #include "content/common/mojo/service_registry_impl.h" |
36 #include "content/common/navigation_params.h" | 37 #include "content/common/navigation_params.h" |
37 #include "content/public/browser/render_frame_host.h" | 38 #include "content/public/browser/render_frame_host.h" |
38 #include "content/public/common/javascript_message_type.h" | 39 #include "content/public/common/javascript_message_type.h" |
| 40 #include "mojo/public/cpp/bindings/binding.h" |
| 41 #include "mojo/public/cpp/bindings/interface_request.h" |
39 #include "net/http/http_response_headers.h" | 42 #include "net/http/http_response_headers.h" |
40 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" | 43 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" |
41 #include "third_party/WebKit/public/web/WebTextDirection.h" | 44 #include "third_party/WebKit/public/web/WebTextDirection.h" |
42 #include "third_party/WebKit/public/web/WebTreeScopeType.h" | 45 #include "third_party/WebKit/public/web/WebTreeScopeType.h" |
43 #include "ui/accessibility/ax_node_data.h" | 46 #include "ui/accessibility/ax_node_data.h" |
44 #include "ui/base/page_transition_types.h" | 47 #include "ui/base/page_transition_types.h" |
45 | 48 |
46 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
47 #include "content/public/browser/android/service_registry_android.h" | 50 #include "content/public/browser/android/service_registry_android.h" |
48 #endif | 51 #endif |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 class RenderWidgetHostViewBase; | 91 class RenderWidgetHostViewBase; |
89 class ResourceRequestBody; | 92 class ResourceRequestBody; |
90 class StreamHandle; | 93 class StreamHandle; |
91 class TimeoutMonitor; | 94 class TimeoutMonitor; |
92 class WebBluetoothServiceImpl; | 95 class WebBluetoothServiceImpl; |
93 struct ContextMenuParams; | 96 struct ContextMenuParams; |
94 struct GlobalRequestID; | 97 struct GlobalRequestID; |
95 struct Referrer; | 98 struct Referrer; |
96 struct ResourceResponse; | 99 struct ResourceResponse; |
97 | 100 |
98 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, | 101 class CONTENT_EXPORT RenderFrameHostImpl |
99 public BrowserAccessibilityDelegate, | 102 : public RenderFrameHost, |
100 public SiteInstanceImpl::Observer { | 103 NON_EXPORTED_BASE(public mojom::FrameHost), |
| 104 public BrowserAccessibilityDelegate, |
| 105 public SiteInstanceImpl::Observer { |
101 public: | 106 public: |
102 using AXTreeSnapshotCallback = | 107 using AXTreeSnapshotCallback = |
103 base::Callback<void( | 108 base::Callback<void( |
104 const ui::AXTreeUpdate&)>; | 109 const ui::AXTreeUpdate&)>; |
105 | 110 |
106 // An accessibility reset is only allowed to prevent very rare corner cases | 111 // An accessibility reset is only allowed to prevent very rare corner cases |
107 // or race conditions where the browser and renderer get out of sync. If | 112 // or race conditions where the browser and renderer get out of sync. If |
108 // this happens more than this many times, kill the renderer. | 113 // this happens more than this many times, kill the renderer. |
109 static const int kMaxAccessibilityResets = 5; | 114 static const int kMaxAccessibilityResets = 5; |
110 | 115 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void ExecuteJavaScriptWithUserGestureForTests( | 148 void ExecuteJavaScriptWithUserGestureForTests( |
144 const base::string16& javascript) override; | 149 const base::string16& javascript) override; |
145 void ActivateFindInPageResultForAccessibility(int request_id) override; | 150 void ActivateFindInPageResultForAccessibility(int request_id) override; |
146 void InsertVisualStateCallback(const VisualStateCallback& callback) override; | 151 void InsertVisualStateCallback(const VisualStateCallback& callback) override; |
147 RenderViewHost* GetRenderViewHost() override; | 152 RenderViewHost* GetRenderViewHost() override; |
148 ServiceRegistry* GetServiceRegistry() override; | 153 ServiceRegistry* GetServiceRegistry() override; |
149 blink::WebPageVisibilityState GetVisibilityState() override; | 154 blink::WebPageVisibilityState GetVisibilityState() override; |
150 bool IsRenderFrameLive() override; | 155 bool IsRenderFrameLive() override; |
151 int GetProxyCount() override; | 156 int GetProxyCount() override; |
152 | 157 |
| 158 // mojom::FrameHost |
| 159 void GetHostZoomLevel(const GURL& url, |
| 160 const GetHostZoomLevelCallback& callback) override; |
| 161 |
153 // IPC::Sender | 162 // IPC::Sender |
154 bool Send(IPC::Message* msg) override; | 163 bool Send(IPC::Message* msg) override; |
155 | 164 |
156 // IPC::Listener | 165 // IPC::Listener |
157 bool OnMessageReceived(const IPC::Message& msg) override; | 166 bool OnMessageReceived(const IPC::Message& msg) override; |
158 | 167 |
159 // BrowserAccessibilityDelegate | 168 // BrowserAccessibilityDelegate |
160 void AccessibilitySetFocus(int acc_obj_id) override; | 169 void AccessibilitySetFocus(int acc_obj_id) override; |
161 void AccessibilityDoDefaultAction(int acc_obj_id) override; | 170 void AccessibilityDoDefaultAction(int acc_obj_id) override; |
162 void AccessibilityShowContextMenu(int acc_obj_id) override; | 171 void AccessibilityShowContextMenu(int acc_obj_id) override; |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 const content::StartNavigationParams& start_params, | 749 const content::StartNavigationParams& start_params, |
741 const content::RequestNavigationParams& request_params); | 750 const content::RequestNavigationParams& request_params); |
742 | 751 |
743 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | 752 // Returns the child FrameTreeNode if |child_frame_routing_id| is an |
744 // immediate child of this FrameTreeNode. |child_frame_routing_id| is | 753 // immediate child of this FrameTreeNode. |child_frame_routing_id| is |
745 // considered untrusted, so the renderer process is killed if it refers to a | 754 // considered untrusted, so the renderer process is killed if it refers to a |
746 // FrameTreeNode that is not a child of this node. | 755 // FrameTreeNode that is not a child of this node. |
747 FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, | 756 FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, |
748 bad_message::BadMessageReason reason); | 757 bad_message::BadMessageReason reason); |
749 | 758 |
| 759 void BindFrameHostService(mojom::FrameHostRequest request); |
| 760 |
750 // Creates a Web Bluetooth Service owned by the frame. | 761 // Creates a Web Bluetooth Service owned by the frame. |
751 void CreateWebBluetoothService( | 762 void CreateWebBluetoothService( |
752 mojo::InterfaceRequest<blink::mojom::WebBluetoothService> request); | 763 mojo::InterfaceRequest<blink::mojom::WebBluetoothService> request); |
753 | 764 |
754 // Deletes the Web Bluetooth Service owned by the frame. | 765 // Deletes the Web Bluetooth Service owned by the frame. |
755 void DeleteWebBluetoothService(); | 766 void DeleteWebBluetoothService(); |
756 | 767 |
757 // Allows tests to disable the swapout event timer to simulate bugs that | 768 // Allows tests to disable the swapout event timer to simulate bugs that |
758 // happen before it fires (to avoid flakiness). | 769 // happen before it fires (to avoid flakiness). |
759 void DisableSwapOutTimerForTesting(); | 770 void DisableSwapOutTimerForTesting(); |
760 | 771 |
761 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 772 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
762 // refcount that calls Shutdown when it reaches zero. This allows each | 773 // refcount that calls Shutdown when it reaches zero. This allows each |
763 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 774 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
764 // we have a RenderViewHost for each RenderFrameHost. | 775 // we have a RenderViewHost for each RenderFrameHost. |
765 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 776 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
766 // some form of page context. | 777 // some form of page context. |
767 RenderViewHostImpl* render_view_host_; | 778 RenderViewHostImpl* render_view_host_; |
768 | 779 |
769 RenderFrameHostDelegate* delegate_; | 780 RenderFrameHostDelegate* delegate_; |
770 | 781 |
| 782 mojo::Binding<mojom::FrameHost> frame_host_binding_; |
| 783 |
771 // The SiteInstance associated with this RenderFrameHost. All content drawn | 784 // The SiteInstance associated with this RenderFrameHost. All content drawn |
772 // in this RenderFrameHost is part of this SiteInstance. Cannot change over | 785 // in this RenderFrameHost is part of this SiteInstance. Cannot change over |
773 // time. | 786 // time. |
774 scoped_refptr<SiteInstanceImpl> site_instance_; | 787 scoped_refptr<SiteInstanceImpl> site_instance_; |
775 | 788 |
776 // The renderer process this RenderFrameHost is associated with. It is | 789 // The renderer process this RenderFrameHost is associated with. It is |
777 // equivalent to the result of site_instance_->GetProcess(), but that | 790 // equivalent to the result of site_instance_->GetProcess(), but that |
778 // method has the side effect of creating the process if it doesn't exist. | 791 // method has the side effect of creating the process if it doesn't exist. |
779 // Cache a pointer to avoid unnecessary process creation. | 792 // Cache a pointer to avoid unnecessary process creation. |
780 RenderProcessHost* process_; | 793 RenderProcessHost* process_; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 988 |
976 // NOTE: This must be the last member. | 989 // NOTE: This must be the last member. |
977 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 990 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
978 | 991 |
979 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 992 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
980 }; | 993 }; |
981 | 994 |
982 } // namespace content | 995 } // namespace content |
983 | 996 |
984 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 997 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |