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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ContentSecurityPolicyHeader; | 96 struct ContentSecurityPolicyHeader; |
94 struct ContextMenuParams; | 97 struct ContextMenuParams; |
95 struct GlobalRequestID; | 98 struct GlobalRequestID; |
96 struct Referrer; | 99 struct Referrer; |
97 struct ResourceResponse; | 100 struct ResourceResponse; |
98 | 101 |
99 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, | 102 class CONTENT_EXPORT RenderFrameHostImpl |
100 public BrowserAccessibilityDelegate, | 103 : public RenderFrameHost, |
101 public SiteInstanceImpl::Observer { | 104 NON_EXPORTED_BASE(public mojom::FrameHost), |
| 105 public BrowserAccessibilityDelegate, |
| 106 public SiteInstanceImpl::Observer { |
102 public: | 107 public: |
103 using AXTreeSnapshotCallback = | 108 using AXTreeSnapshotCallback = |
104 base::Callback<void( | 109 base::Callback<void( |
105 const ui::AXTreeUpdate&)>; | 110 const ui::AXTreeUpdate&)>; |
106 | 111 |
107 // An accessibility reset is only allowed to prevent very rare corner cases | 112 // An accessibility reset is only allowed to prevent very rare corner cases |
108 // or race conditions where the browser and renderer get out of sync. If | 113 // or race conditions where the browser and renderer get out of sync. If |
109 // this happens more than this many times, kill the renderer. | 114 // this happens more than this many times, kill the renderer. |
110 static const int kMaxAccessibilityResets = 5; | 115 static const int kMaxAccessibilityResets = 5; |
111 | 116 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void ExecuteJavaScriptWithUserGestureForTests( | 149 void ExecuteJavaScriptWithUserGestureForTests( |
145 const base::string16& javascript) override; | 150 const base::string16& javascript) override; |
146 void ActivateFindInPageResultForAccessibility(int request_id) override; | 151 void ActivateFindInPageResultForAccessibility(int request_id) override; |
147 void InsertVisualStateCallback(const VisualStateCallback& callback) override; | 152 void InsertVisualStateCallback(const VisualStateCallback& callback) override; |
148 RenderViewHost* GetRenderViewHost() override; | 153 RenderViewHost* GetRenderViewHost() override; |
149 ServiceRegistry* GetServiceRegistry() override; | 154 ServiceRegistry* GetServiceRegistry() override; |
150 blink::WebPageVisibilityState GetVisibilityState() override; | 155 blink::WebPageVisibilityState GetVisibilityState() override; |
151 bool IsRenderFrameLive() override; | 156 bool IsRenderFrameLive() override; |
152 int GetProxyCount() override; | 157 int GetProxyCount() override; |
153 | 158 |
| 159 // mojom::FrameHost |
| 160 void GetHostZoomLevel(const GURL& url, |
| 161 const GetHostZoomLevelCallback& callback) override; |
| 162 |
154 // IPC::Sender | 163 // IPC::Sender |
155 bool Send(IPC::Message* msg) override; | 164 bool Send(IPC::Message* msg) override; |
156 | 165 |
157 // IPC::Listener | 166 // IPC::Listener |
158 bool OnMessageReceived(const IPC::Message& msg) override; | 167 bool OnMessageReceived(const IPC::Message& msg) override; |
159 | 168 |
160 // BrowserAccessibilityDelegate | 169 // BrowserAccessibilityDelegate |
161 void AccessibilitySetFocus(int acc_obj_id) override; | 170 void AccessibilitySetFocus(int acc_obj_id) override; |
162 void AccessibilityDoDefaultAction(int acc_obj_id) override; | 171 void AccessibilityDoDefaultAction(int acc_obj_id) override; |
163 void AccessibilityShowContextMenu(int acc_obj_id) override; | 172 void AccessibilityShowContextMenu(int acc_obj_id) override; |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 const content::StartNavigationParams& start_params, | 751 const content::StartNavigationParams& start_params, |
743 const content::RequestNavigationParams& request_params); | 752 const content::RequestNavigationParams& request_params); |
744 | 753 |
745 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | 754 // Returns the child FrameTreeNode if |child_frame_routing_id| is an |
746 // immediate child of this FrameTreeNode. |child_frame_routing_id| is | 755 // immediate child of this FrameTreeNode. |child_frame_routing_id| is |
747 // considered untrusted, so the renderer process is killed if it refers to a | 756 // considered untrusted, so the renderer process is killed if it refers to a |
748 // FrameTreeNode that is not a child of this node. | 757 // FrameTreeNode that is not a child of this node. |
749 FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, | 758 FrameTreeNode* FindAndVerifyChild(int32_t child_frame_routing_id, |
750 bad_message::BadMessageReason reason); | 759 bad_message::BadMessageReason reason); |
751 | 760 |
| 761 void BindFrameHostService(mojom::FrameHostRequest request); |
| 762 |
752 // Creates a Web Bluetooth Service owned by the frame. | 763 // Creates a Web Bluetooth Service owned by the frame. |
753 void CreateWebBluetoothService( | 764 void CreateWebBluetoothService( |
754 mojo::InterfaceRequest<blink::mojom::WebBluetoothService> request); | 765 mojo::InterfaceRequest<blink::mojom::WebBluetoothService> request); |
755 | 766 |
756 // Deletes the Web Bluetooth Service owned by the frame. | 767 // Deletes the Web Bluetooth Service owned by the frame. |
757 void DeleteWebBluetoothService(); | 768 void DeleteWebBluetoothService(); |
758 | 769 |
759 // Allows tests to disable the swapout event timer to simulate bugs that | 770 // Allows tests to disable the swapout event timer to simulate bugs that |
760 // happen before it fires (to avoid flakiness). | 771 // happen before it fires (to avoid flakiness). |
761 void DisableSwapOutTimerForTesting(); | 772 void DisableSwapOutTimerForTesting(); |
762 | 773 |
763 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 774 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
764 // refcount that calls Shutdown when it reaches zero. This allows each | 775 // refcount that calls Shutdown when it reaches zero. This allows each |
765 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 776 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
766 // we have a RenderViewHost for each RenderFrameHost. | 777 // we have a RenderViewHost for each RenderFrameHost. |
767 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 778 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
768 // some form of page context. | 779 // some form of page context. |
769 RenderViewHostImpl* render_view_host_; | 780 RenderViewHostImpl* render_view_host_; |
770 | 781 |
771 RenderFrameHostDelegate* delegate_; | 782 RenderFrameHostDelegate* delegate_; |
772 | 783 |
| 784 mojo::Binding<mojom::FrameHost> frame_host_binding_; |
| 785 |
773 // The SiteInstance associated with this RenderFrameHost. All content drawn | 786 // The SiteInstance associated with this RenderFrameHost. All content drawn |
774 // in this RenderFrameHost is part of this SiteInstance. Cannot change over | 787 // in this RenderFrameHost is part of this SiteInstance. Cannot change over |
775 // time. | 788 // time. |
776 scoped_refptr<SiteInstanceImpl> site_instance_; | 789 scoped_refptr<SiteInstanceImpl> site_instance_; |
777 | 790 |
778 // The renderer process this RenderFrameHost is associated with. It is | 791 // The renderer process this RenderFrameHost is associated with. It is |
779 // equivalent to the result of site_instance_->GetProcess(), but that | 792 // equivalent to the result of site_instance_->GetProcess(), but that |
780 // method has the side effect of creating the process if it doesn't exist. | 793 // method has the side effect of creating the process if it doesn't exist. |
781 // Cache a pointer to avoid unnecessary process creation. | 794 // Cache a pointer to avoid unnecessary process creation. |
782 RenderProcessHost* process_; | 795 RenderProcessHost* process_; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 990 |
978 // NOTE: This must be the last member. | 991 // NOTE: This must be the last member. |
979 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 992 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
980 | 993 |
981 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 994 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
982 }; | 995 }; |
983 | 996 |
984 } // namespace content | 997 } // namespace content |
985 | 998 |
986 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 999 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |