Chromium Code Reviews| 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); | |
|
alexmos
2015/10/02 21:24:20
What is this function for? I don't see it used an
lazyboy
2015/10/05 22:16:08
Used to be used on previous iterations, removed.
| |
| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 IPC::Message* reply_msg); | 537 IPC::Message* reply_msg); |
| 532 void OnTextSurroundingSelectionResponse(const base::string16& content, | 538 void OnTextSurroundingSelectionResponse(const base::string16& content, |
| 533 size_t start_offset, | 539 size_t start_offset, |
| 534 size_t end_offset); | 540 size_t end_offset); |
| 535 void OnDidAccessInitialDocument(); | 541 void OnDidAccessInitialDocument(); |
| 536 void OnDidChangeOpener(int32 opener_routing_id); | 542 void OnDidChangeOpener(int32 opener_routing_id); |
| 537 void OnDidChangeName(const std::string& name); | 543 void OnDidChangeName(const std::string& name); |
| 538 void OnDidAssignPageId(int32 page_id); | 544 void OnDidAssignPageId(int32 page_id); |
| 539 void OnDidChangeSandboxFlags(int32 frame_routing_id, | 545 void OnDidChangeSandboxFlags(int32 frame_routing_id, |
| 540 blink::WebSandboxFlags flags); | 546 blink::WebSandboxFlags flags); |
| 547 void OnDidChangeFrameOwnerProperties( | |
| 548 int32 frame_routing_id, | |
| 549 const blink::WebFrameOwnerProperties& frame_owner_properties); | |
| 541 void OnUpdateTitle(const base::string16& title, | 550 void OnUpdateTitle(const base::string16& title, |
| 542 blink::WebTextDirection title_direction); | 551 blink::WebTextDirection title_direction); |
| 543 void OnUpdateEncoding(const std::string& encoding); | 552 void OnUpdateEncoding(const std::string& encoding); |
| 544 void OnBeginNavigation(const CommonNavigationParams& common_params, | 553 void OnBeginNavigation(const CommonNavigationParams& common_params, |
| 545 const BeginNavigationParams& begin_params, | 554 const BeginNavigationParams& begin_params, |
| 546 scoped_refptr<ResourceRequestBody> body); | 555 scoped_refptr<ResourceRequestBody> body); |
| 547 void OnDispatchLoad(); | 556 void OnDispatchLoad(); |
| 548 void OnAccessibilityEvents( | 557 void OnAccessibilityEvents( |
| 549 const std::vector<AccessibilityHostMsg_EventParams>& params, | 558 const std::vector<AccessibilityHostMsg_EventParams>& params, |
| 550 int reset_token); | 559 int reset_token); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 // Convert the content-layer-specific AXContentNodeData to a general-purpose | 612 // Convert the content-layer-specific AXContentNodeData to a general-purpose |
| 604 // AXNodeData structure. | 613 // AXNodeData structure. |
| 605 void AXContentNodeDataToAXNodeData(const AXContentNodeData& src, | 614 void AXContentNodeDataToAXNodeData(const AXContentNodeData& src, |
| 606 ui::AXNodeData* dst); | 615 ui::AXNodeData* dst); |
| 607 | 616 |
| 608 // Returns the RenderWidgetHostView used for accessibility. For subframes, | 617 // Returns the RenderWidgetHostView used for accessibility. For subframes, |
| 609 // this function will return the platform view on the main frame; for main | 618 // this function will return the platform view on the main frame; for main |
| 610 // frames, it will return the current frame's view. | 619 // frames, it will return the current frame's view. |
| 611 RenderWidgetHostViewBase* GetViewForAccessibility(); | 620 RenderWidgetHostViewBase* GetViewForAccessibility(); |
| 612 | 621 |
| 622 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | |
| 623 // immediate child of this FrameTreeNode. Kills this renderer otherwise | |
| 624 // with bad message |reason|. | |
| 625 FrameTreeNode* CheckAndGetIfImmediateChild( | |
| 626 int32 child_frame_routing_id, bad_message::BadMessageReason reason); | |
| 627 | |
| 613 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 628 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
| 614 // refcount that calls Shutdown when it reaches zero. This allows each | 629 // refcount that calls Shutdown when it reaches zero. This allows each |
| 615 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 630 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
| 616 // we have a RenderViewHost for each RenderFrameHost. | 631 // we have a RenderViewHost for each RenderFrameHost. |
| 617 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 632 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
| 618 // some form of page context. | 633 // some form of page context. |
| 619 RenderViewHostImpl* render_view_host_; | 634 RenderViewHostImpl* render_view_host_; |
| 620 | 635 |
| 621 RenderFrameHostDelegate* delegate_; | 636 RenderFrameHostDelegate* delegate_; |
| 622 | 637 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 | 795 |
| 781 // NOTE: This must be the last member. | 796 // NOTE: This must be the last member. |
| 782 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 797 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 783 | 798 |
| 784 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 799 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 785 }; | 800 }; |
| 786 | 801 |
| 787 } // namespace content | 802 } // namespace content |
| 788 | 803 |
| 789 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 804 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |