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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 ScreenOrientationProvider* GetScreenOrientationProvider() override; | 479 ScreenOrientationProvider* GetScreenOrientationProvider() override; |
480 void EnterFullscreenMode(const GURL& origin) override; | 480 void EnterFullscreenMode(const GURL& origin) override; |
481 void ExitFullscreenMode(bool will_cause_resize) override; | 481 void ExitFullscreenMode(bool will_cause_resize) override; |
482 bool ShouldRouteMessageEvent( | 482 bool ShouldRouteMessageEvent( |
483 RenderFrameHost* target_rfh, | 483 RenderFrameHost* target_rfh, |
484 SiteInstance* source_site_instance) const override; | 484 SiteInstance* source_site_instance) const override; |
485 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; | 485 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
486 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( | 486 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
487 const GURL& url) override; | 487 const GURL& url) override; |
488 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; | 488 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; |
| 489 RenderFrameHost* GetFrameAtNode(FrameTreeNode* tree_node) override; |
489 void OnFocusedElementChangedInFrame( | 490 void OnFocusedElementChangedInFrame( |
490 RenderFrameHostImpl* frame, | 491 RenderFrameHostImpl* frame, |
491 const gfx::Rect& bounds_in_root_view) override; | 492 const gfx::Rect& bounds_in_root_view) override; |
492 void CreateNewWindow( | 493 void CreateNewWindow( |
493 SiteInstance* source_site_instance, | 494 SiteInstance* source_site_instance, |
494 int32_t render_view_route_id, | 495 int32_t render_view_route_id, |
495 int32_t main_frame_route_id, | 496 int32_t main_frame_route_id, |
496 int32_t main_frame_widget_route_id, | 497 int32_t main_frame_widget_route_id, |
497 const mojom::CreateNewWindowParams& params, | 498 const mojom::CreateNewWindowParams& params, |
498 SessionStorageNamespace* session_storage_namespace) override; | 499 SessionStorageNamespace* session_storage_namespace) override; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 // still remain disjoint. | 842 // still remain disjoint. |
842 // The parent is referred to as "outer WebContents" and the descendents are | 843 // The parent is referred to as "outer WebContents" and the descendents are |
843 // referred to as "inner WebContents". | 844 // referred to as "inner WebContents". |
844 // For each inner WebContents, the outer WebContents will have a | 845 // For each inner WebContents, the outer WebContents will have a |
845 // corresponding FrameTreeNode. | 846 // corresponding FrameTreeNode. |
846 struct WebContentsTreeNode { | 847 struct WebContentsTreeNode { |
847 public: | 848 public: |
848 WebContentsTreeNode(); | 849 WebContentsTreeNode(); |
849 ~WebContentsTreeNode(); | 850 ~WebContentsTreeNode(); |
850 | 851 |
851 typedef std::set<WebContentsTreeNode*> ChildrenSet; | 852 typedef std::map<int, WebContentsImpl*> ChildrenMap; |
852 | 853 |
853 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 854 void ConnectToOuterWebContents(WebContentsImpl* web_contents, |
| 855 WebContentsImpl* outer_web_contents, |
854 RenderFrameHostImpl* outer_contents_frame); | 856 RenderFrameHostImpl* outer_contents_frame); |
855 | 857 |
856 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 858 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
857 int outer_contents_frame_tree_node_id() const { | 859 int outer_contents_frame_tree_node_id() const { |
858 return outer_contents_frame_tree_node_id_; | 860 return outer_contents_frame_tree_node_id_; |
859 } | 861 } |
860 | 862 |
861 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } | 863 WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
862 void SetFocusedWebContents(WebContentsImpl* web_contents); | 864 void SetFocusedWebContents(WebContentsImpl* web_contents); |
863 | 865 |
| 866 // Returns the WebContents at a tree node in the frame tree or nullptr if |
| 867 // there is none. |
| 868 WebContentsImpl* find_contents_at_node(int frame_tree_node_id); |
| 869 |
864 private: | 870 private: |
865 // The outer WebContents. | 871 // The outer WebContents. |
866 WebContentsImpl* outer_web_contents_; | 872 WebContentsImpl* outer_web_contents_; |
867 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 873 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
868 int outer_contents_frame_tree_node_id_; | 874 int outer_contents_frame_tree_node_id_; |
869 // List of inner WebContents that we host. | 875 // List of inner WebContents that we host. |
870 ChildrenSet inner_web_contents_tree_nodes_; | 876 ChildrenMap inner_web_contents_tree_nodes_; |
871 // Only the root node should have this set. This indicates the WebContents | 877 // Only the root node should have this set. This indicates the WebContents |
872 // whose frame tree has the focused frame. The WebContents tree could be | 878 // whose frame tree has the focused frame. The WebContents tree could be |
873 // arbitrarily deep. | 879 // arbitrarily deep. |
874 WebContentsImpl* focused_web_contents_; | 880 WebContentsImpl* focused_web_contents_; |
875 }; | 881 }; |
876 | 882 |
877 // See WebContents::Create for a description of these parameters. | 883 // See WebContents::Create for a description of these parameters. |
878 WebContentsImpl(BrowserContext* browser_context); | 884 WebContentsImpl(BrowserContext* browser_context); |
879 | 885 |
880 // Add and remove observers for page navigation notifications. The order in | 886 // Add and remove observers for page navigation notifications. The order in |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 // Adds/removes a callback called on creation of each new WebContents. | 1519 // Adds/removes a callback called on creation of each new WebContents. |
1514 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1520 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1515 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1521 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1516 | 1522 |
1517 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1523 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1518 }; | 1524 }; |
1519 | 1525 |
1520 } // namespace content | 1526 } // namespace content |
1521 | 1527 |
1522 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1528 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |