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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 // still remain disjoint. | 848 // still remain disjoint. |
848 // The parent is referred to as "outer WebContents" and the descendents are | 849 // The parent is referred to as "outer WebContents" and the descendents are |
849 // referred to as "inner WebContents". | 850 // referred to as "inner WebContents". |
850 // For each inner WebContents, the outer WebContents will have a | 851 // For each inner WebContents, the outer WebContents will have a |
851 // corresponding FrameTreeNode. | 852 // corresponding FrameTreeNode. |
852 struct WebContentsTreeNode { | 853 struct WebContentsTreeNode { |
853 public: | 854 public: |
854 WebContentsTreeNode(); | 855 WebContentsTreeNode(); |
855 ~WebContentsTreeNode(); | 856 ~WebContentsTreeNode(); |
856 | 857 |
857 typedef std::set<WebContentsTreeNode*> ChildrenSet; | 858 typedef std::map<int, WebContentsImpl*> ChildrenMap; |
858 | 859 |
859 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 860 void ConnectToOuterWebContents(WebContentsImpl* web_contents, |
861 WebContentsImpl* outer_web_contents, | |
860 RenderFrameHostImpl* outer_contents_frame); | 862 RenderFrameHostImpl* outer_contents_frame); |
861 | 863 |
862 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 864 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
863 int outer_contents_frame_tree_node_id() const { | 865 int outer_contents_frame_tree_node_id() const { |
864 return outer_contents_frame_tree_node_id_; | 866 return outer_contents_frame_tree_node_id_; |
865 } | 867 } |
866 | 868 |
867 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } | 869 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
868 void SetFocusedWebContents(WebContentsImpl* web_contents); | 870 void SetFocusedWebContents(WebContentsImpl* web_contents); |
869 | 871 |
872 // Returns the WebContents at a tree node in the frame tree or nullptr if | |
873 // there is none. | |
874 WebContentsImpl* FindInnerWebContentsAtNode(FrameTreeNode* node); | |
875 | |
870 private: | 876 private: |
871 // The outer WebContents. | 877 // The outer WebContents. |
872 WebContentsImpl* outer_web_contents_; | 878 WebContentsImpl* outer_web_contents_; |
873 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 879 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
874 int outer_contents_frame_tree_node_id_; | 880 int outer_contents_frame_tree_node_id_; |
875 // List of inner WebContents that we host. | 881 // List of inner WebContents that we host. Is is indexed by FrameTreeNode |
alexmos
2017/03/03 20:07:57
nit: s/Is is/It is/
avallee
2017/06/21 02:25:35
reverted.
| |
876 ChildrenSet inner_web_contents_tree_nodes_; | 882 // id. |
883 ChildrenMap inner_web_contents_tree_nodes_; | |
877 // Only the root node should have this set. This indicates the WebContents | 884 // Only the root node should have this set. This indicates the WebContents |
878 // whose frame tree has the focused frame. The WebContents tree could be | 885 // whose frame tree has the focused frame. The WebContents tree could be |
879 // arbitrarily deep. | 886 // arbitrarily deep. |
880 WebContentsImpl* focused_web_contents_; | 887 WebContentsImpl* focused_web_contents_; |
881 }; | 888 }; |
882 | 889 |
883 // See WebContents::Create for a description of these parameters. | 890 // See WebContents::Create for a description of these parameters. |
884 WebContentsImpl(BrowserContext* browser_context); | 891 WebContentsImpl(BrowserContext* browser_context); |
885 | 892 |
886 // Add and remove observers for page navigation notifications. The order in | 893 // Add and remove observers for page navigation notifications. The order in |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 // WebContentsImpl. This will activate this content's main frame RenderWidget | 1071 // WebContentsImpl. This will activate this content's main frame RenderWidget |
1065 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will | 1072 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will |
1066 // search this WebContentsImpl for a focused RenderWidgetHost. The previously | 1073 // search this WebContentsImpl for a focused RenderWidgetHost. The previously |
1067 // focused WebContentsImpl, if any, will have its RenderWidgetHosts | 1074 // focused WebContentsImpl, if any, will have its RenderWidgetHosts |
1068 // deactivated. | 1075 // deactivated. |
1069 void SetAsFocusedWebContentsIfNecessary(); | 1076 void SetAsFocusedWebContentsIfNecessary(); |
1070 | 1077 |
1071 // Returns the root of the WebContents tree. | 1078 // Returns the root of the WebContents tree. |
1072 WebContentsImpl* GetOutermostWebContents(); | 1079 WebContentsImpl* GetOutermostWebContents(); |
1073 | 1080 |
1081 // Walks up to the outermost WebContents and focuses the frame tree node where | |
alexmos
2017/03/03 20:07:57
nit: s/frame tree node/FrameTreeNode/. Also, clar
avallee
2017/06/21 02:25:35
Done.
| |
1082 // the current WebContents is attached. | |
1083 void FocusOuterAttachmentFrameChain(); | |
1084 | |
1074 // Navigation helpers -------------------------------------------------------- | 1085 // Navigation helpers -------------------------------------------------------- |
1075 // | 1086 // |
1076 // These functions are helpers for Navigate() and DidNavigate(). | 1087 // These functions are helpers for Navigate() and DidNavigate(). |
1077 | 1088 |
1078 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 1089 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
1079 // committed to the navigation controller. Note that the navigation entry is | 1090 // committed to the navigation controller. Note that the navigation entry is |
1080 // not provided since it may be invalid/changed after being committed. The | 1091 // not provided since it may be invalid/changed after being committed. The |
1081 // current navigation entry is in the NavigationController at this point. | 1092 // current navigation entry is in the NavigationController at this point. |
1082 | 1093 |
1083 // Helper for CreateNewWidget/CreateNewFullscreenWidget. | 1094 // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1529 // Adds/removes a callback called on creation of each new WebContents. | 1540 // Adds/removes a callback called on creation of each new WebContents. |
1530 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1541 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1531 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1542 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1532 | 1543 |
1533 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1544 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1534 }; | 1545 }; |
1535 | 1546 |
1536 } // namespace content | 1547 } // namespace content |
1537 | 1548 |
1538 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1549 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |