| 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/bad_message.h" |
| 19 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
| 20 #include "content/browser/webui/web_ui_impl.h" | |
| 21 #include "content/common/accessibility_mode_enums.h" | 20 #include "content/common/accessibility_mode_enums.h" |
| 22 #include "content/common/ax_content_node_data.h" | 21 #include "content/common/ax_content_node_data.h" |
| 23 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
| 24 #include "content/common/frame_message_enums.h" | 23 #include "content/common/frame_message_enums.h" |
| 25 #include "content/common/frame_replication_state.h" | 24 #include "content/common/frame_replication_state.h" |
| 26 #include "content/common/image_downloader/image_downloader.mojom.h" | 25 #include "content/common/image_downloader/image_downloader.mojom.h" |
| 27 #include "content/common/mojo/service_registry_impl.h" | 26 #include "content/common/mojo/service_registry_impl.h" |
| 28 #include "content/common/navigation_params.h" | 27 #include "content/common/navigation_params.h" |
| 29 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
| 30 #include "content/public/common/javascript_message_type.h" | 29 #include "content/public/common/javascript_message_type.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 int new_routing_id, | 211 int new_routing_id, |
| 213 blink::WebTreeScopeType scope, | 212 blink::WebTreeScopeType scope, |
| 214 const std::string& frame_name, | 213 const std::string& frame_name, |
| 215 blink::WebSandboxFlags sandbox_flags, | 214 blink::WebSandboxFlags sandbox_flags, |
| 216 const blink::WebFrameOwnerProperties& frame_owner_properties); | 215 const blink::WebFrameOwnerProperties& frame_owner_properties); |
| 217 | 216 |
| 218 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 217 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
| 219 RenderFrameHostDelegate* delegate() { return delegate_; } | 218 RenderFrameHostDelegate* delegate() { return delegate_; } |
| 220 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 219 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 221 | 220 |
| 222 // Returns the associated WebUI or null if none applies. | |
| 223 WebUIImpl* web_ui() const { return web_ui_.get(); } | |
| 224 | |
| 225 // Returns the associated WebUI type. | |
| 226 WebUI::TypeID web_ui_type() const { return web_ui_type_; } | |
| 227 | |
| 228 // Returns this RenderFrameHost's loading state. This method is only used by | 221 // Returns this RenderFrameHost's loading state. This method is only used by |
| 229 // FrameTreeNode. The proper way to check whether a frame is loading is to | 222 // FrameTreeNode. The proper way to check whether a frame is loading is to |
| 230 // call FrameTreeNode::IsLoading. | 223 // call FrameTreeNode::IsLoading. |
| 231 bool is_loading() const { return is_loading_; } | 224 bool is_loading() const { return is_loading_; } |
| 232 | 225 |
| 233 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 226 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 234 // or else it returns nullptr. | 227 // or else it returns nullptr. |
| 235 // If the RenderFrameHost is the page's main frame, this returns instead a | 228 // If the RenderFrameHost is the page's main frame, this returns instead a |
| 236 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 229 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
| 237 RenderWidgetHostImpl* GetRenderWidgetHost(); | 230 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 466 |
| 474 // Tears down the browser-side state relating to the Mojo connection between | 467 // Tears down the browser-side state relating to the Mojo connection between |
| 475 // this instance and its associated render frame. | 468 // this instance and its associated render frame. |
| 476 void InvalidateMojoConnection(); | 469 void InvalidateMojoConnection(); |
| 477 | 470 |
| 478 // Returns whether the frame is focused. A frame is considered focused when it | 471 // Returns whether the frame is focused. A frame is considered focused when it |
| 479 // is the parent chain of the focused frame within the frame tree. In | 472 // is the parent chain of the focused frame within the frame tree. In |
| 480 // addition, its associated RenderWidgetHost has to be focused. | 473 // addition, its associated RenderWidgetHost has to be focused. |
| 481 bool IsFocused(); | 474 bool IsFocused(); |
| 482 | 475 |
| 483 // Updates the WebUI of this RenderFrameHost based on the provided |dest_url|, | |
| 484 // setting it to either none, a new instance or simply reuses the currently | |
| 485 // existing one. Returns true if a WebUI change occurred. | |
| 486 // If this is a history navigation its NavigationEntry bindings should be | |
| 487 // provided through |entry_bindings| to allow verifying that they are not | |
| 488 // being set differently this time around. Otherwise |entry_bindings| should | |
| 489 // be set to NavigationEntryImpl::kInvalidBindings so that no checks are done. | |
| 490 bool UpdateWebUI(const GURL& dest_url, int entry_bindings); | |
| 491 | |
| 492 // Returns the Mojo ImageDownloader service. | 476 // Returns the Mojo ImageDownloader service. |
| 493 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 477 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
| 494 | 478 |
| 495 protected: | 479 protected: |
| 496 friend class RenderFrameHostFactory; | 480 friend class RenderFrameHostFactory; |
| 497 | 481 |
| 498 // |flags| is a combination of CreateRenderFrameFlags. | 482 // |flags| is a combination of CreateRenderFrameFlags. |
| 499 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 483 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 500 // should be the abstraction needed here, but we need RenderViewHost to pass | 484 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 501 // into WebContentsObserver::FrameDetached for now. | 485 // into WebContentsObserver::FrameDetached for now. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 const content::StartNavigationParams& start_params, | 635 const content::StartNavigationParams& start_params, |
| 652 const content::RequestNavigationParams& request_params); | 636 const content::RequestNavigationParams& request_params); |
| 653 | 637 |
| 654 // Returns the child FrameTreeNode if |child_frame_routing_id| is an | 638 // Returns the child FrameTreeNode if |child_frame_routing_id| is an |
| 655 // immediate child of this FrameTreeNode. |child_frame_routing_id| is | 639 // immediate child of this FrameTreeNode. |child_frame_routing_id| is |
| 656 // considered untrusted, so the renderer process is killed if it refers to a | 640 // considered untrusted, so the renderer process is killed if it refers to a |
| 657 // FrameTreeNode that is not a child of this node. | 641 // FrameTreeNode that is not a child of this node. |
| 658 FrameTreeNode* FindAndVerifyChild( | 642 FrameTreeNode* FindAndVerifyChild( |
| 659 int32 child_frame_routing_id, bad_message::BadMessageReason reason); | 643 int32 child_frame_routing_id, bad_message::BadMessageReason reason); |
| 660 | 644 |
| 661 // Resets all WebUI related fields. | |
| 662 void ResetWebUI(); | |
| 663 | |
| 664 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 645 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
| 665 // refcount that calls Shutdown when it reaches zero. This allows each | 646 // refcount that calls Shutdown when it reaches zero. This allows each |
| 666 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 647 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
| 667 // we have a RenderViewHost for each RenderFrameHost. | 648 // we have a RenderViewHost for each RenderFrameHost. |
| 668 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 649 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
| 669 // some form of page context. | 650 // some form of page context. |
| 670 RenderViewHostImpl* render_view_host_; | 651 RenderViewHostImpl* render_view_host_; |
| 671 | 652 |
| 672 RenderFrameHostDelegate* delegate_; | 653 RenderFrameHostDelegate* delegate_; |
| 673 | 654 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 // Holder of Mojo connection with ImageDownloader service in RenderFrame. | 803 // Holder of Mojo connection with ImageDownloader service in RenderFrame. |
| 823 image_downloader::ImageDownloaderPtr mojo_image_downloader_; | 804 image_downloader::ImageDownloaderPtr mojo_image_downloader_; |
| 824 | 805 |
| 825 // Tracks a navigation happening in this frame. Note that while there can be | 806 // Tracks a navigation happening in this frame. Note that while there can be |
| 826 // two navigations in the same FrameTreeNode, there can only be one | 807 // two navigations in the same FrameTreeNode, there can only be one |
| 827 // navigation per RenderFrameHost. | 808 // navigation per RenderFrameHost. |
| 828 // PlzNavigate: before the navigation is ready to be committed, the | 809 // PlzNavigate: before the navigation is ready to be committed, the |
| 829 // NavigationHandle for it is owned by the NavigationRequest. | 810 // NavigationHandle for it is owned by the NavigationRequest. |
| 830 scoped_ptr<NavigationHandleImpl> navigation_handle_; | 811 scoped_ptr<NavigationHandleImpl> navigation_handle_; |
| 831 | 812 |
| 832 // The associated WebUIImpl and its type. They will be set if the current | |
| 833 // document or the one being navigated to is from WebUI source. Otherwise they | |
| 834 // will be null and WebUI::kNoWebUI, respectively. | |
| 835 scoped_ptr<WebUIImpl> web_ui_; | |
| 836 WebUI::TypeID web_ui_type_; | |
| 837 | |
| 838 // NOTE: This must be the last member. | 813 // NOTE: This must be the last member. |
| 839 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 814 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 840 | 815 |
| 841 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 816 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 842 }; | 817 }; |
| 843 | 818 |
| 844 } // namespace content | 819 } // namespace content |
| 845 | 820 |
| 846 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 821 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |