| 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* GetFocusedFrameIncludingInnerWebContents() 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 // WebContentsImpl. This will activate this content's main frame RenderWidget | 1064 // WebContentsImpl. This will activate this content's main frame RenderWidget |
| 1059 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will | 1065 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will |
| 1060 // search this WebContentsImpl for a focused RenderWidgetHost. The previously | 1066 // search this WebContentsImpl for a focused RenderWidgetHost. The previously |
| 1061 // focused WebContentsImpl, if any, will have its RenderWidgetHosts | 1067 // focused WebContentsImpl, if any, will have its RenderWidgetHosts |
| 1062 // deactivated. | 1068 // deactivated. |
| 1063 void SetAsFocusedWebContentsIfNecessary(); | 1069 void SetAsFocusedWebContentsIfNecessary(); |
| 1064 | 1070 |
| 1065 // Returns the root of the WebContents tree. | 1071 // Returns the root of the WebContents tree. |
| 1066 WebContentsImpl* GetOutermostWebContents(); | 1072 WebContentsImpl* GetOutermostWebContents(); |
| 1067 | 1073 |
| 1074 // Walks up to the outermost WebContents and focuses the frame tree node where |
| 1075 // the current WebContents is attached. |
| 1076 void FocusOuterAttachmentFrameChain(); |
| 1077 |
| 1068 // Navigation helpers -------------------------------------------------------- | 1078 // Navigation helpers -------------------------------------------------------- |
| 1069 // | 1079 // |
| 1070 // These functions are helpers for Navigate() and DidNavigate(). | 1080 // These functions are helpers for Navigate() and DidNavigate(). |
| 1071 | 1081 |
| 1072 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 1082 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 1073 // committed to the navigation controller. Note that the navigation entry is | 1083 // committed to the navigation controller. Note that the navigation entry is |
| 1074 // not provided since it may be invalid/changed after being committed. The | 1084 // not provided since it may be invalid/changed after being committed. The |
| 1075 // current navigation entry is in the NavigationController at this point. | 1085 // current navigation entry is in the NavigationController at this point. |
| 1076 | 1086 |
| 1077 // Helper for CreateNewWidget/CreateNewFullscreenWidget. | 1087 // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 // Adds/removes a callback called on creation of each new WebContents. | 1523 // Adds/removes a callback called on creation of each new WebContents. |
| 1514 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1524 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1515 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1525 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1516 | 1526 |
| 1517 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1527 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1518 }; | 1528 }; |
| 1519 | 1529 |
| 1520 } // namespace content | 1530 } // namespace content |
| 1521 | 1531 |
| 1522 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1532 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |