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