| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 GeolocationServiceContext* GetGeolocationServiceContext() override; | 457 GeolocationServiceContext* GetGeolocationServiceContext() override; |
| 458 WakeLockServiceContext* GetWakeLockServiceContext() override; | 458 WakeLockServiceContext* GetWakeLockServiceContext() override; |
| 459 void EnterFullscreenMode(const GURL& origin) override; | 459 void EnterFullscreenMode(const GURL& origin) override; |
| 460 void ExitFullscreenMode(bool will_cause_resize) override; | 460 void ExitFullscreenMode(bool will_cause_resize) override; |
| 461 bool ShouldRouteMessageEvent( | 461 bool ShouldRouteMessageEvent( |
| 462 RenderFrameHost* target_rfh, | 462 RenderFrameHost* target_rfh, |
| 463 SiteInstance* source_site_instance) const override; | 463 SiteInstance* source_site_instance) const override; |
| 464 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; | 464 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
| 465 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( | 465 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
| 466 const GURL& url) override; | 466 const GURL& url) override; |
| 467 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; |
| 467 | 468 |
| 468 // RenderViewHostDelegate ---------------------------------------------------- | 469 // RenderViewHostDelegate ---------------------------------------------------- |
| 469 RenderViewHostDelegateView* GetDelegateView() override; | 470 RenderViewHostDelegateView* GetDelegateView() override; |
| 470 bool OnMessageReceived(RenderViewHost* render_view_host, | 471 bool OnMessageReceived(RenderViewHost* render_view_host, |
| 471 const IPC::Message& message) override; | 472 const IPC::Message& message) override; |
| 472 // RenderFrameHostDelegate has the same method, so list it there because this | 473 // RenderFrameHostDelegate has the same method, so list it there because this |
| 473 // interface is going away. | 474 // interface is going away. |
| 474 // WebContents* GetAsWebContents() override; | 475 // WebContents* GetAsWebContents() override; |
| 475 void RenderViewCreated(RenderViewHost* render_view_host) override; | 476 void RenderViewCreated(RenderViewHost* render_view_host) override; |
| 476 void RenderViewReady(RenderViewHost* render_view_host) override; | 477 void RenderViewReady(RenderViewHost* render_view_host) override; |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 public: | 826 public: |
| 826 WebContentsTreeNode(); | 827 WebContentsTreeNode(); |
| 827 ~WebContentsTreeNode(); | 828 ~WebContentsTreeNode(); |
| 828 | 829 |
| 829 typedef std::set<WebContentsTreeNode*> ChildrenSet; | 830 typedef std::set<WebContentsTreeNode*> ChildrenSet; |
| 830 | 831 |
| 831 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 832 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 832 RenderFrameHostImpl* outer_contents_frame); | 833 RenderFrameHostImpl* outer_contents_frame); |
| 833 | 834 |
| 834 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 835 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 835 int outer_contents_frame_tree_node_id() { | 836 int outer_contents_frame_tree_node_id() const { |
| 836 return outer_contents_frame_tree_node_id_; | 837 return outer_contents_frame_tree_node_id_; |
| 837 } | 838 } |
| 838 | 839 |
| 840 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
| 841 void SetFocusedWebContents(WebContentsImpl* web_contents); |
| 842 |
| 839 private: | 843 private: |
| 840 // The outer WebContents. | 844 // The outer WebContents. |
| 841 WebContentsImpl* outer_web_contents_; | 845 WebContentsImpl* outer_web_contents_; |
| 842 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 846 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 843 int outer_contents_frame_tree_node_id_; | 847 int outer_contents_frame_tree_node_id_; |
| 844 // List of inner WebContents that we host. | 848 // List of inner WebContents that we host. |
| 845 ChildrenSet inner_web_contents_tree_nodes_; | 849 ChildrenSet inner_web_contents_tree_nodes_; |
| 850 // Only the root node should have this set. This indicates the WebContents |
| 851 // whose frame tree has the focused frame. The WebContents tree could be |
| 852 // arbitrarily deep. |
| 853 WebContentsImpl* focused_web_contents_; |
| 846 }; | 854 }; |
| 847 | 855 |
| 848 // See WebContents::Create for a description of these parameters. | 856 // See WebContents::Create for a description of these parameters. |
| 849 WebContentsImpl(BrowserContext* browser_context); | 857 WebContentsImpl(BrowserContext* browser_context); |
| 850 | 858 |
| 851 // Add and remove observers for page navigation notifications. The order in | 859 // Add and remove observers for page navigation notifications. The order in |
| 852 // which notifications are sent to observers is undefined. Clients must be | 860 // which notifications are sent to observers is undefined. Clients must be |
| 853 // sure to remove the observer before they go away. | 861 // sure to remove the observer before they go away. |
| 854 void AddObserver(WebContentsObserver* observer); | 862 void AddObserver(WebContentsObserver* observer); |
| 855 void RemoveObserver(WebContentsObserver* observer); | 863 void RemoveObserver(WebContentsObserver* observer); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 const base::string16& main_text, | 981 const base::string16& main_text, |
| 974 const base::string16& sub_text); | 982 const base::string16& sub_text); |
| 975 void OnHideValidationMessage(); | 983 void OnHideValidationMessage(); |
| 976 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); | 984 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); |
| 977 | 985 |
| 978 // Called by derived classes to indicate that we're no longer waiting for a | 986 // Called by derived classes to indicate that we're no longer waiting for a |
| 979 // response. This won't actually update the throbber, but it will get picked | 987 // response. This won't actually update the throbber, but it will get picked |
| 980 // up at the next animation step if the throbber is going. | 988 // up at the next animation step if the throbber is going. |
| 981 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 989 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 982 | 990 |
| 991 // Returns the focused WebContents. |
| 992 // If there are multiple inner/outer WebContents (when embedding <webview>, |
| 993 // <guestview>, ...) returns the single one containing the currently focused |
| 994 // frame. Otherwise, returns this WebContents. |
| 995 WebContentsImpl* GetFocusedWebContents(); |
| 996 |
| 997 // Returns the root of the WebContents tree. |
| 998 WebContentsImpl* GetOutermostWebContents(); |
| 999 |
| 983 // Navigation helpers -------------------------------------------------------- | 1000 // Navigation helpers -------------------------------------------------------- |
| 984 // | 1001 // |
| 985 // These functions are helpers for Navigate() and DidNavigate(). | 1002 // These functions are helpers for Navigate() and DidNavigate(). |
| 986 | 1003 |
| 987 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 1004 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 988 // committed to the navigation controller. Note that the navigation entry is | 1005 // committed to the navigation controller. Note that the navigation entry is |
| 989 // not provided since it may be invalid/changed after being committed. The | 1006 // not provided since it may be invalid/changed after being committed. The |
| 990 // current navigation entry is in the NavigationController at this point. | 1007 // current navigation entry is in the NavigationController at this point. |
| 991 | 1008 |
| 992 // If our controller was restored, update the max page ID associated with the | 1009 // If our controller was restored, update the max page ID associated with the |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1087 |
| 1071 // Internal helper to create WebUI objects associated with |this|. |url| is | 1088 // Internal helper to create WebUI objects associated with |this|. |url| is |
| 1072 // used to determine which WebUI should be created (if any). |frame_name| | 1089 // used to determine which WebUI should be created (if any). |frame_name| |
| 1073 // corresponds to the name of a frame that the WebUI should be created for (or | 1090 // corresponds to the name of a frame that the WebUI should be created for (or |
| 1074 // the main frame if empty). | 1091 // the main frame if empty). |
| 1075 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); | 1092 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); |
| 1076 | 1093 |
| 1077 void SetJavaScriptDialogManagerForTesting( | 1094 void SetJavaScriptDialogManagerForTesting( |
| 1078 JavaScriptDialogManager* dialog_manager); | 1095 JavaScriptDialogManager* dialog_manager); |
| 1079 | 1096 |
| 1080 // Returns the outermost WebContents in this WebContents's tree. | |
| 1081 WebContentsImpl* GetOutermostWebContents(); | |
| 1082 | |
| 1083 // Returns the FindRequestManager, or creates one if it doesn't already exist. | 1097 // Returns the FindRequestManager, or creates one if it doesn't already exist. |
| 1084 FindRequestManager* GetOrCreateFindRequestManager(); | 1098 FindRequestManager* GetOrCreateFindRequestManager(); |
| 1085 | 1099 |
| 1086 // Data for core operation --------------------------------------------------- | 1100 // Data for core operation --------------------------------------------------- |
| 1087 | 1101 |
| 1088 // Delegate for notifying our owner about stuff. Not owned by us. | 1102 // Delegate for notifying our owner about stuff. Not owned by us. |
| 1089 WebContentsDelegate* delegate_; | 1103 WebContentsDelegate* delegate_; |
| 1090 | 1104 |
| 1091 // Handles the back/forward list and loading. | 1105 // Handles the back/forward list and loading. |
| 1092 NavigationControllerImpl controller_; | 1106 NavigationControllerImpl controller_; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 // Adds/removes a callback called on creation of each new WebContents. | 1433 // Adds/removes a callback called on creation of each new WebContents. |
| 1420 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1434 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1421 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1435 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1422 | 1436 |
| 1423 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1437 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1424 }; | 1438 }; |
| 1425 | 1439 |
| 1426 } // namespace content | 1440 } // namespace content |
| 1427 | 1441 |
| 1428 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1442 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |