| 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 pending WebUI, or null if none applies. | |
| 226 WebUIImpl* pending_web_ui() const { | |
| 227 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | |
| 228 } | |
| 229 | |
| 230 // 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 |
| 231 // 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 |
| 232 // call FrameTreeNode::IsLoading. | 223 // call FrameTreeNode::IsLoading. |
| 233 bool is_loading() const { return is_loading_; } | 224 bool is_loading() const { return is_loading_; } |
| 234 | 225 |
| 235 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, | 226 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, |
| 236 // or else it returns nullptr. | 227 // or else it returns nullptr. |
| 237 // 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 |
| 238 // pointer to the RenderViewHost (which inherits RenderWidgetHost). | 229 // pointer to the RenderViewHost (which inherits RenderWidgetHost). |
| 239 RenderWidgetHostImpl* GetRenderWidgetHost(); | 230 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 471 |
| 481 // Tears down the browser-side state relating to the Mojo connection between | 472 // Tears down the browser-side state relating to the Mojo connection between |
| 482 // this instance and its associated render frame. | 473 // this instance and its associated render frame. |
| 483 void InvalidateMojoConnection(); | 474 void InvalidateMojoConnection(); |
| 484 | 475 |
| 485 // Returns whether the frame is focused. A frame is considered focused when it | 476 // Returns whether the frame is focused. A frame is considered focused when it |
| 486 // is the parent chain of the focused frame within the frame tree. In | 477 // is the parent chain of the focused frame within the frame tree. In |
| 487 // addition, its associated RenderWidgetHost has to be focused. | 478 // addition, its associated RenderWidgetHost has to be focused. |
| 488 bool IsFocused(); | 479 bool IsFocused(); |
| 489 | 480 |
| 490 // Updates the pending WebUI of this RenderFrameHost based on the provided | |
| 491 // |dest_url|, setting it to either none, a new instance or to reuse the | |
| 492 // currently active one. Returns true if the pending WebUI was updated. | |
| 493 // If this is a history navigation its NavigationEntry bindings should be | |
| 494 // provided through |entry_bindings| to allow verifying that they are not | |
| 495 // being set differently this time around. Otherwise |entry_bindings| should | |
| 496 // be set to NavigationEntryImpl::kInvalidBindings so that no checks are done. | |
| 497 bool UpdatePendingWebUI(const GURL& dest_url, int entry_bindings); | |
| 498 | |
| 499 // Updates the active WebUI with the pending one set by the last call to | |
| 500 // UpdatePendingWebUI and then clears any pending data. If UpdatePendingWebUI | |
| 501 // was not called the active WebUI will simply be cleared. | |
| 502 void CommitPendingWebUI(); | |
| 503 | |
| 504 // Destroys the pending WebUI and resets related data. | |
| 505 void ClearPendingWebUI(); | |
| 506 | |
| 507 // Destroys all WebUI instances and resets related data. | |
| 508 void ClearAllWebUI(); | |
| 509 | |
| 510 // Returns the Mojo ImageDownloader service. | 481 // Returns the Mojo ImageDownloader service. |
| 511 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); | 482 const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
| 512 | 483 |
| 513 protected: | 484 protected: |
| 514 friend class RenderFrameHostFactory; | 485 friend class RenderFrameHostFactory; |
| 515 | 486 |
| 516 // |flags| is a combination of CreateRenderFrameFlags. | 487 // |flags| is a combination of CreateRenderFrameFlags. |
| 517 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 488 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 518 // should be the abstraction needed here, but we need RenderViewHost to pass | 489 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 519 // into WebContentsObserver::FrameDetached for now. | 490 // into WebContentsObserver::FrameDetached for now. |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 // Holder of Mojo connection with ImageDownloader service in RenderFrame. | 818 // Holder of Mojo connection with ImageDownloader service in RenderFrame. |
| 848 image_downloader::ImageDownloaderPtr mojo_image_downloader_; | 819 image_downloader::ImageDownloaderPtr mojo_image_downloader_; |
| 849 | 820 |
| 850 // Tracks a navigation happening in this frame. Note that while there can be | 821 // Tracks a navigation happening in this frame. Note that while there can be |
| 851 // two navigations in the same FrameTreeNode, there can only be one | 822 // two navigations in the same FrameTreeNode, there can only be one |
| 852 // navigation per RenderFrameHost. | 823 // navigation per RenderFrameHost. |
| 853 // PlzNavigate: before the navigation is ready to be committed, the | 824 // PlzNavigate: before the navigation is ready to be committed, the |
| 854 // NavigationHandle for it is owned by the NavigationRequest. | 825 // NavigationHandle for it is owned by the NavigationRequest. |
| 855 scoped_ptr<NavigationHandleImpl> navigation_handle_; | 826 scoped_ptr<NavigationHandleImpl> navigation_handle_; |
| 856 | 827 |
| 857 // The associated WebUIImpl and its type. They will be set if the current | |
| 858 // document is from WebUI source. Otherwise they will be null and | |
| 859 // WebUI::kNoWebUI, respectively. | |
| 860 scoped_ptr<WebUIImpl> web_ui_; | |
| 861 WebUI::TypeID web_ui_type_; | |
| 862 | |
| 863 // The pending WebUIImpl and its type. These values will be used exclusively | |
| 864 // for same-site navigations to keep a transition of a WebUI in a pending | |
| 865 // state until the navigation commits. | |
| 866 scoped_ptr<WebUIImpl> pending_web_ui_; | |
| 867 WebUI::TypeID pending_web_ui_type_; | |
| 868 | |
| 869 // If true the associated WebUI should be reused when CommitPendingWebUI is | |
| 870 // called (no pending instance should be set). | |
| 871 bool should_reuse_web_ui_; | |
| 872 | |
| 873 // NOTE: This must be the last member. | 828 // NOTE: This must be the last member. |
| 874 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 829 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 875 | 830 |
| 876 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 831 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 877 }; | 832 }; |
| 878 | 833 |
| 879 } // namespace content | 834 } // namespace content |
| 880 | 835 |
| 881 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 836 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |