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/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
| 19 #include "content/browser/webui/web_ui_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" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 int routing_id() const { return routing_id_; } | 208 int routing_id() const { return routing_id_; } |
208 void OnCreateChildFrame(int new_routing_id, | 209 void OnCreateChildFrame(int new_routing_id, |
209 blink::WebTreeScopeType scope, | 210 blink::WebTreeScopeType scope, |
210 const std::string& frame_name, | 211 const std::string& frame_name, |
211 blink::WebSandboxFlags sandbox_flags); | 212 blink::WebSandboxFlags sandbox_flags); |
212 | 213 |
213 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 214 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
214 RenderFrameHostDelegate* delegate() { return delegate_; } | 215 RenderFrameHostDelegate* delegate() { return delegate_; } |
215 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 216 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
216 | 217 |
| 218 // Returns the associated WebUI or null if none applies. |
| 219 WebUIImpl* web_ui() const { return web_ui_.get(); } |
| 220 |
| 221 // Returns the associated WebUI type. |
| 222 WebUI::TypeID web_ui_type() const { return web_ui_type_; } |
| 223 |
217 // Returns this RenderFrameHost's loading state. This method is only used by | 224 // Returns this RenderFrameHost's loading state. This method is only used by |
218 // FrameTreeNode. The proper way to check whether a frame is loading is to | 225 // FrameTreeNode. The proper way to check whether a frame is loading is to |
219 // call FrameTreeNode::IsLoading. | 226 // call FrameTreeNode::IsLoading. |
220 bool is_loading() const { return is_loading_; } | 227 bool is_loading() const { return is_loading_; } |
221 | 228 |
222 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 229 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
223 // or else it returns nullptr. | 230 // or else it returns nullptr. |
224 // If the RenderFrameHost is the page's main frame, this returns instead a | 231 // If the RenderFrameHost is the page's main frame, this returns instead a |
225 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 232 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
226 RenderWidgetHostImpl* GetRenderWidgetHost(); | 233 RenderWidgetHostImpl* GetRenderWidgetHost(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 469 |
463 // Tears down the browser-side state relating to the Mojo connection between | 470 // Tears down the browser-side state relating to the Mojo connection between |
464 // this instance and its associated render frame. | 471 // this instance and its associated render frame. |
465 void InvalidateMojoConnection(); | 472 void InvalidateMojoConnection(); |
466 | 473 |
467 // Returns whether the frame is focused. A frame is considered focused when it | 474 // Returns whether the frame is focused. A frame is considered focused when it |
468 // is the parent chain of the focused frame within the frame tree. In | 475 // is the parent chain of the focused frame within the frame tree. In |
469 // addition, its associated RenderWidgetHost has to be focused. | 476 // addition, its associated RenderWidgetHost has to be focused. |
470 bool IsFocused(); | 477 bool IsFocused(); |
471 | 478 |
| 479 // Updates the WebUI data of this RenderFrameHost based on the |
| 480 // provided |dest_url|, setting to either none, a new instance or reuses the |
| 481 // current active one. Returns true if there was a change of WebUI. |
| 482 // If this is a history navigation its NavigationEntry bindings should be |
| 483 // provided through |entry_bindings| to allow verifying that they are not |
| 484 // being set differently this time around. Otherwise |entry_bindings| should |
| 485 // be set to NavigationEntryImpl::kInvalidBindings so that no checks are made. |
| 486 bool UpdateWebUI(const GURL& dest_url, int entry_bindings); |
| 487 |
472 // Returns the Mojo ImageDownloader service. | 488 // Returns the Mojo ImageDownloader service. |
473 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 489 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
474 | 490 |
475 protected: | 491 protected: |
476 friend class RenderFrameHostFactory; | 492 friend class RenderFrameHostFactory; |
477 | 493 |
478 // |flags| is a combination of CreateRenderFrameFlags. | 494 // |flags| is a combination of CreateRenderFrameFlags. |
479 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 495 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
480 // should be the abstraction needed here, but we need RenderViewHost to pass | 496 // should be the abstraction needed here, but we need RenderViewHost to pass |
481 // into WebContentsObserver::FrameDetached for now. | 497 // into WebContentsObserver::FrameDetached for now. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 RenderWidgetHostViewBase* GetViewForAccessibility(); | 637 RenderWidgetHostViewBase* GetViewForAccessibility(); |
622 | 638 |
623 // Sends a navigate message to the RenderFrame and notifies DevTools about | 639 // Sends a navigate message to the RenderFrame and notifies DevTools about |
624 // navigation happening. Should be used instead of sending the message | 640 // navigation happening. Should be used instead of sending the message |
625 // directly. | 641 // directly. |
626 void SendNavigateMessage( | 642 void SendNavigateMessage( |
627 const content::CommonNavigationParams& common_params, | 643 const content::CommonNavigationParams& common_params, |
628 const content::StartNavigationParams& start_params, | 644 const content::StartNavigationParams& start_params, |
629 const content::RequestNavigationParams& request_params); | 645 const content::RequestNavigationParams& request_params); |
630 | 646 |
| 647 // Resets all active and pending WebUI related fields. |
| 648 void ResetWebUI(); |
| 649 |
631 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 650 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
632 // refcount that calls Shutdown when it reaches zero. This allows each | 651 // refcount that calls Shutdown when it reaches zero. This allows each |
633 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 652 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
634 // we have a RenderViewHost for each RenderFrameHost. | 653 // we have a RenderViewHost for each RenderFrameHost. |
635 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 654 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
636 // some form of page context. | 655 // some form of page context. |
637 RenderViewHostImpl* render_view_host_; | 656 RenderViewHostImpl* render_view_host_; |
638 | 657 |
639 RenderFrameHostDelegate* delegate_; | 658 RenderFrameHostDelegate* delegate_; |
640 | 659 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 // Holder of Mojo connection with ImageDownloader service in RenderFrame. | 808 // Holder of Mojo connection with ImageDownloader service in RenderFrame. |
790 image_downloader::ImageDownloaderPtr mojo_image_downloader_; | 809 image_downloader::ImageDownloaderPtr mojo_image_downloader_; |
791 | 810 |
792 // Tracks a navigation happening in this frame. Note that while there can be | 811 // Tracks a navigation happening in this frame. Note that while there can be |
793 // two navigations in the same FrameTreeNode, there can only be one | 812 // two navigations in the same FrameTreeNode, there can only be one |
794 // navigation per RenderFrameHost. | 813 // navigation per RenderFrameHost. |
795 // PlzNavigate: before the navigation is ready to be committed, the | 814 // PlzNavigate: before the navigation is ready to be committed, the |
796 // NavigationHandle for it is owned by the NavigationRequest. | 815 // NavigationHandle for it is owned by the NavigationRequest. |
797 scoped_ptr<NavigationHandleImpl> navigation_handle_; | 816 scoped_ptr<NavigationHandleImpl> navigation_handle_; |
798 | 817 |
| 818 // The associated WebUIImpl and its type. They will be set if the current |
| 819 // document is from WebUI source. Otherwise they will be null and |
| 820 // WebUI::kNoWebUI, respectively. |
| 821 scoped_ptr<WebUIImpl> web_ui_; |
| 822 WebUI::TypeID web_ui_type_; |
| 823 |
799 // NOTE: This must be the last member. | 824 // NOTE: This must be the last member. |
800 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 825 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
801 | 826 |
802 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 827 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
803 }; | 828 }; |
804 | 829 |
805 } // namespace content | 830 } // namespace content |
806 | 831 |
807 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 832 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |