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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
18 #include "content/browser/bad_message.h" | |
18 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
19 #include "content/common/accessibility_mode_enums.h" | 20 #include "content/common/accessibility_mode_enums.h" |
20 #include "content/common/ax_content_node_data.h" | 21 #include "content/common/ax_content_node_data.h" |
21 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
22 #include "content/common/frame_message_enums.h" | 23 #include "content/common/frame_message_enums.h" |
23 #include "content/common/frame_replication_state.h" | 24 #include "content/common/frame_replication_state.h" |
24 #include "content/common/image_downloader/image_downloader.mojom.h" | 25 #include "content/common/image_downloader/image_downloader.mojom.h" |
25 #include "content/common/mojo/service_registry_impl.h" | 26 #include "content/common/mojo/service_registry_impl.h" |
26 #include "content/common/navigation_params.h" | 27 #include "content/common/navigation_params.h" |
27 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
28 #include "content/public/common/javascript_message_type.h" | 29 #include "content/public/common/javascript_message_type.h" |
29 #include "net/http/http_response_headers.h" | 30 #include "net/http/http_response_headers.h" |
31 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" | |
30 #include "third_party/WebKit/public/web/WebTextDirection.h" | 32 #include "third_party/WebKit/public/web/WebTextDirection.h" |
31 #include "third_party/WebKit/public/web/WebTreeScopeType.h" | 33 #include "third_party/WebKit/public/web/WebTreeScopeType.h" |
32 #include "ui/accessibility/ax_node_data.h" | 34 #include "ui/accessibility/ax_node_data.h" |
33 #include "ui/base/page_transition_types.h" | 35 #include "ui/base/page_transition_types.h" |
34 | 36 |
35 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
36 #include "content/browser/mojo/service_registry_android.h" | 38 #include "content/browser/mojo/service_registry_android.h" |
37 #endif | 39 #endif |
38 | 40 |
39 class GURL; | 41 class GURL; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 198 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
197 // the renderer process. This is currently only used for subframes. | 199 // the renderer process. This is currently only used for subframes. |
198 // TODO(creis): Use this for main frames as well when RVH goes away. | 200 // TODO(creis): Use this for main frames as well when RVH goes away. |
199 void SetRenderFrameCreated(bool created); | 201 void SetRenderFrameCreated(bool created); |
200 | 202 |
201 // Called for renderer-created windows to resume requests from this frame, | 203 // Called for renderer-created windows to resume requests from this frame, |
202 // after they are blocked in RenderWidgetHelper::CreateNewWindow. | 204 // after they are blocked in RenderWidgetHelper::CreateNewWindow. |
203 void Init(); | 205 void Init(); |
204 | 206 |
205 int routing_id() const { return routing_id_; } | 207 int routing_id() const { return routing_id_; } |
206 void OnCreateChildFrame(int new_routing_id, | 208 void OnCreateChildFrame( |
207 blink::WebTreeScopeType scope, | 209 int new_routing_id, |
208 const std::string& frame_name, | 210 blink::WebTreeScopeType scope, |
209 blink::WebSandboxFlags sandbox_flags); | 211 const std::string& frame_name, |
212 blink::WebSandboxFlags sandbox_flags, | |
213 const blink::WebFrameOwnerProperties& frame_owner_properties); | |
210 | 214 |
211 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 215 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
212 RenderFrameHostDelegate* delegate() { return delegate_; } | 216 RenderFrameHostDelegate* delegate() { return delegate_; } |
213 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 217 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
214 | 218 |
215 // Returns this RenderFrameHost's loading state. This method is only used by | 219 // Returns this RenderFrameHost's loading state. This method is only used by |
216 // FrameTreeNode. The proper way to check whether a frame is loading is to | 220 // FrameTreeNode. The proper way to check whether a frame is loading is to |
217 // call FrameTreeNode::IsLoading. | 221 // call FrameTreeNode::IsLoading. |
218 bool is_loading() const { return is_loading_; } | 222 bool is_loading() const { return is_loading_; } |
219 | 223 |
(...skipping 21 matching lines...) Expand all Loading... | |
241 | 245 |
242 void set_render_frame_proxy_host(RenderFrameProxyHost* proxy) { | 246 void set_render_frame_proxy_host(RenderFrameProxyHost* proxy) { |
243 render_frame_proxy_host_ = proxy; | 247 render_frame_proxy_host_ = proxy; |
244 } | 248 } |
245 | 249 |
246 // Returns a bitwise OR of bindings types that have been enabled for this | 250 // Returns a bitwise OR of bindings types that have been enabled for this |
247 // RenderFrameHostImpl's RenderView. See BindingsPolicy for details. | 251 // RenderFrameHostImpl's RenderView. See BindingsPolicy for details. |
248 // TODO(creis): Make bindings frame-specific, to support cases like <webview>. | 252 // TODO(creis): Make bindings frame-specific, to support cases like <webview>. |
249 int GetEnabledBindings(); | 253 int GetEnabledBindings(); |
250 | 254 |
255 void DidChangeChildFrameOwnerProperties(FrameTreeNode* child); | |
256 | |
251 NavigationHandleImpl* navigation_handle() const { | 257 NavigationHandleImpl* navigation_handle() const { |
252 return navigation_handle_.get(); | 258 return navigation_handle_.get(); |
253 } | 259 } |
254 | 260 |
255 // Called when a new navigation starts in this RenderFrameHost. Ownership of | 261 // Called when a new navigation starts in this RenderFrameHost. Ownership of |
256 // |navigation_handle| is transferred. | 262 // |navigation_handle| is transferred. |
257 // PlzNavigate: called when a navigation is ready to commit in this | 263 // PlzNavigate: called when a navigation is ready to commit in this |
258 // RenderFrameHost. | 264 // RenderFrameHost. |
259 void SetNavigationHandle(scoped_ptr<NavigationHandleImpl> navigation_handle); | 265 void SetNavigationHandle(scoped_ptr<NavigationHandleImpl> navigation_handle); |
260 | 266 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 IPC::Message* reply_msg); | 538 IPC::Message* reply_msg); |
533 void OnTextSurroundingSelectionResponse(const base::string16& content, | 539 void OnTextSurroundingSelectionResponse(const base::string16& content, |
534 size_t start_offset, | 540 size_t start_offset, |
535 size_t end_offset); | 541 size_t end_offset); |
536 void OnDidAccessInitialDocument(); | 542 void OnDidAccessInitialDocument(); |
537 void OnDidChangeOpener(int32 opener_routing_id); | 543 void OnDidChangeOpener(int32 opener_routing_id); |
538 void OnDidChangeName(const std::string& name); | 544 void OnDidChangeName(const std::string& name); |
539 void OnDidAssignPageId(int32 page_id); | 545 void OnDidAssignPageId(int32 page_id); |
540 void OnDidChangeSandboxFlags(int32 frame_routing_id, | 546 void OnDidChangeSandboxFlags(int32 frame_routing_id, |
541 blink::WebSandboxFlags flags); | 547 blink::WebSandboxFlags flags); |
548 void OnDidChangeFrameOwnerProperties( | |
549 int32 frame_routing_id, | |
550 const blink::WebFrameOwnerProperties& frame_owner_properties); | |
542 void OnUpdateTitle(const base::string16& title, | 551 void OnUpdateTitle(const base::string16& title, |
543 blink::WebTextDirection title_direction); | 552 blink::WebTextDirection title_direction); |
544 void OnUpdateEncoding(const std::string& encoding); | 553 void OnUpdateEncoding(const std::string& encoding); |
545 void OnBeginNavigation(const CommonNavigationParams& common_params, | 554 void OnBeginNavigation(const CommonNavigationParams& common_params, |
546 const BeginNavigationParams& begin_params, | 555 const BeginNavigationParams& begin_params, |
547 scoped_refptr<ResourceRequestBody> body); | 556 scoped_refptr<ResourceRequestBody> body); |
548 void OnDispatchLoad(); | 557 void OnDispatchLoad(); |
549 void OnAccessibilityEvents( | 558 void OnAccessibilityEvents( |
550 const std::vector<AccessibilityHostMsg_EventParams>& params, | 559 const std::vector<AccessibilityHostMsg_EventParams>& params, |
551 int reset_token); | 560 int reset_token); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 | 608 |
600 // Map a browser plugin instance ID to the AXTreeID of the plugin's | 609 // Map a browser plugin instance ID to the AXTreeID of the plugin's |
601 // main frame. | 610 // main frame. |
602 AXTreeIDRegistry::AXTreeID BrowserPluginInstanceIDToAXTreeID(int routing_id); | 611 AXTreeIDRegistry::AXTreeID BrowserPluginInstanceIDToAXTreeID(int routing_id); |
603 | 612 |
604 // Convert the content-layer-specific AXContentNodeData to a general-purpose | 613 // Convert the content-layer-specific AXContentNodeData to a general-purpose |
605 // AXNodeData structure. | 614 // AXNodeData structure. |
606 void AXContentNodeDataToAXNodeData(const AXContentNodeData& src, | 615 void AXContentNodeDataToAXNodeData(const AXContentNodeData& src, |
607 ui::AXNodeData* dst); | 616 ui::AXNodeData* dst); |
608 | 617 |
618 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | |
619 // immediate child of this FrameTreeNode. Kills this renderer otherwise | |
620 // with bad message |reason|. | |
621 FrameTreeNode* CheckAndGetIfImmediateChild( | |
alexmos
2015/09/21 18:53:22
Maybe this fits better in the anonymous namespace
lazyboy
2015/09/22 02:38:54
I still need |this|, do you mean to also pass that
alexmos
2015/09/22 16:56:52
Ah, right. It's fine to keep it where it is then.
| |
622 int32 child_frame_routing_id, bad_message::BadMessageReason reason); | |
623 | |
609 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 624 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
610 // refcount that calls Shutdown when it reaches zero. This allows each | 625 // refcount that calls Shutdown when it reaches zero. This allows each |
611 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 626 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
612 // we have a RenderViewHost for each RenderFrameHost. | 627 // we have a RenderViewHost for each RenderFrameHost. |
613 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 628 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
614 // some form of page context. | 629 // some form of page context. |
615 RenderViewHostImpl* render_view_host_; | 630 RenderViewHostImpl* render_view_host_; |
616 | 631 |
617 RenderFrameHostDelegate* delegate_; | 632 RenderFrameHostDelegate* delegate_; |
618 | 633 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 | 791 |
777 // NOTE: This must be the last member. | 792 // NOTE: This must be the last member. |
778 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 793 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
779 | 794 |
780 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 795 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
781 }; | 796 }; |
782 | 797 |
783 } // namespace content | 798 } // namespace content |
784 | 799 |
785 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 800 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |