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