Chromium Code Reviews| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 device::WakeLockServiceContext* GetWakeLockServiceContext() override; | 485 device::WakeLockServiceContext* GetWakeLockServiceContext() override; |
| 486 void EnterFullscreenMode(const GURL& origin) override; | 486 void EnterFullscreenMode(const GURL& origin) override; |
| 487 void ExitFullscreenMode(bool will_cause_resize) override; | 487 void ExitFullscreenMode(bool will_cause_resize) override; |
| 488 bool ShouldRouteMessageEvent( | 488 bool ShouldRouteMessageEvent( |
| 489 RenderFrameHost* target_rfh, | 489 RenderFrameHost* target_rfh, |
| 490 SiteInstance* source_site_instance) const override; | 490 SiteInstance* source_site_instance) const override; |
| 491 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; | 491 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
| 492 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( | 492 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
| 493 const GURL& url) override; | 493 const GURL& url) override; |
| 494 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; | 494 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; |
| 495 RenderFrameHost* GetFocusedFrameIncludingInnerWebContents() override; | |
| 495 void OnFocusedElementChangedInFrame( | 496 void OnFocusedElementChangedInFrame( |
| 496 RenderFrameHostImpl* frame, | 497 RenderFrameHostImpl* frame, |
| 497 const gfx::Rect& bounds_in_root_view) override; | 498 const gfx::Rect& bounds_in_root_view) override; |
| 498 void CreateNewWindow( | 499 void CreateNewWindow( |
| 499 SiteInstance* source_site_instance, | 500 SiteInstance* source_site_instance, |
| 500 int32_t render_view_route_id, | 501 int32_t render_view_route_id, |
| 501 int32_t main_frame_route_id, | 502 int32_t main_frame_route_id, |
| 502 int32_t main_frame_widget_route_id, | 503 int32_t main_frame_widget_route_id, |
| 503 const mojom::CreateNewWindowParams& params, | 504 const mojom::CreateNewWindowParams& params, |
| 504 SessionStorageNamespace* session_storage_namespace) override; | 505 SessionStorageNamespace* session_storage_namespace) override; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 // still remain disjoint. | 850 // still remain disjoint. |
| 850 // The parent is referred to as "outer WebContents" and the descendents are | 851 // The parent is referred to as "outer WebContents" and the descendents are |
| 851 // referred to as "inner WebContents". | 852 // referred to as "inner WebContents". |
| 852 // For each inner WebContents, the outer WebContents will have a | 853 // For each inner WebContents, the outer WebContents will have a |
| 853 // corresponding FrameTreeNode. | 854 // corresponding FrameTreeNode. |
| 854 struct WebContentsTreeNode { | 855 struct WebContentsTreeNode { |
| 855 public: | 856 public: |
| 856 WebContentsTreeNode(); | 857 WebContentsTreeNode(); |
| 857 ~WebContentsTreeNode(); | 858 ~WebContentsTreeNode(); |
| 858 | 859 |
| 859 typedef std::set<WebContentsTreeNode*> ChildrenSet; | 860 typedef std::map<int, WebContentsImpl*> ChildrenMap; |
| 860 | 861 |
| 861 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 862 void ConnectToOuterWebContents(WebContentsImpl* web_contents, |
| 863 WebContentsImpl* outer_web_contents, | |
| 862 RenderFrameHostImpl* outer_contents_frame); | 864 RenderFrameHostImpl* outer_contents_frame); |
| 863 | 865 |
| 864 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 866 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 865 int outer_contents_frame_tree_node_id() const { | 867 int outer_contents_frame_tree_node_id() const { |
| 866 return outer_contents_frame_tree_node_id_; | 868 return outer_contents_frame_tree_node_id_; |
| 867 } | 869 } |
| 868 | 870 |
| 869 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } | 871 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
| 870 void SetFocusedWebContents(WebContentsImpl* web_contents); | 872 void SetFocusedWebContents(WebContentsImpl* web_contents); |
| 871 | 873 |
| 874 // Returns the WebContents at a tree node in the frame tree or nullptr if | |
| 875 // there is none. | |
| 876 WebContentsImpl* find_contents_at_node(int frame_tree_node_id); | |
| 877 | |
| 872 private: | 878 private: |
| 873 // The outer WebContents. | 879 // The outer WebContents. |
| 874 WebContentsImpl* outer_web_contents_; | 880 WebContentsImpl* outer_web_contents_; |
| 875 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 881 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 876 int outer_contents_frame_tree_node_id_; | 882 int outer_contents_frame_tree_node_id_; |
| 877 // List of inner WebContents that we host. | 883 // List of inner WebContents that we host. |
|
alexmos
2017/02/23 20:07:05
Mention that this is now indexed by FrameTreeNode
avallee
2017/02/28 20:13:01
Done.
| |
| 878 ChildrenSet inner_web_contents_tree_nodes_; | 884 ChildrenMap inner_web_contents_tree_nodes_; |
| 879 // Only the root node should have this set. This indicates the WebContents | 885 // Only the root node should have this set. This indicates the WebContents |
| 880 // whose frame tree has the focused frame. The WebContents tree could be | 886 // whose frame tree has the focused frame. The WebContents tree could be |
| 881 // arbitrarily deep. | 887 // arbitrarily deep. |
| 882 WebContentsImpl* focused_web_contents_; | 888 WebContentsImpl* focused_web_contents_; |
| 883 }; | 889 }; |
| 884 | 890 |
| 885 // See WebContents::Create for a description of these parameters. | 891 // See WebContents::Create for a description of these parameters. |
| 886 WebContentsImpl(BrowserContext* browser_context); | 892 WebContentsImpl(BrowserContext* browser_context); |
| 887 | 893 |
| 888 // Add and remove observers for page navigation notifications. The order in | 894 // Add and remove observers for page navigation notifications. The order in |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1066 // WebContentsImpl. This will activate this content's main frame RenderWidget | 1072 // WebContentsImpl. This will activate this content's main frame RenderWidget |
| 1067 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will | 1073 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will |
| 1068 // search this WebContentsImpl for a focused RenderWidgetHost. The previously | 1074 // search this WebContentsImpl for a focused RenderWidgetHost. The previously |
| 1069 // focused WebContentsImpl, if any, will have its RenderWidgetHosts | 1075 // focused WebContentsImpl, if any, will have its RenderWidgetHosts |
| 1070 // deactivated. | 1076 // deactivated. |
| 1071 void SetAsFocusedWebContentsIfNecessary(); | 1077 void SetAsFocusedWebContentsIfNecessary(); |
| 1072 | 1078 |
| 1073 // Returns the root of the WebContents tree. | 1079 // Returns the root of the WebContents tree. |
| 1074 WebContentsImpl* GetOutermostWebContents(); | 1080 WebContentsImpl* GetOutermostWebContents(); |
| 1075 | 1081 |
| 1082 // Walks up to the outermost WebContents and focuses the frame tree node where | |
| 1083 // the current WebContents is attached. | |
| 1084 void FocusOuterAttachmentFrameChain(); | |
| 1085 | |
| 1076 // Navigation helpers -------------------------------------------------------- | 1086 // Navigation helpers -------------------------------------------------------- |
| 1077 // | 1087 // |
| 1078 // These functions are helpers for Navigate() and DidNavigate(). | 1088 // These functions are helpers for Navigate() and DidNavigate(). |
| 1079 | 1089 |
| 1080 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 1090 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 1081 // committed to the navigation controller. Note that the navigation entry is | 1091 // committed to the navigation controller. Note that the navigation entry is |
| 1082 // not provided since it may be invalid/changed after being committed. The | 1092 // not provided since it may be invalid/changed after being committed. The |
| 1083 // current navigation entry is in the NavigationController at this point. | 1093 // current navigation entry is in the NavigationController at this point. |
| 1084 | 1094 |
| 1085 // Helper for CreateNewWidget/CreateNewFullscreenWidget. | 1095 // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1531 // Adds/removes a callback called on creation of each new WebContents. | 1541 // Adds/removes a callback called on creation of each new WebContents. |
| 1532 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1542 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1533 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1543 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1534 | 1544 |
| 1535 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1545 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1536 }; | 1546 }; |
| 1537 | 1547 |
| 1538 } // namespace content | 1548 } // namespace content |
| 1539 | 1549 |
| 1540 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1550 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |