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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 GeolocationServiceContext* GetGeolocationServiceContext() override; | 456 GeolocationServiceContext* GetGeolocationServiceContext() override; |
| 457 WakeLockServiceContext* GetWakeLockServiceContext() override; | 457 WakeLockServiceContext* GetWakeLockServiceContext() override; |
| 458 void EnterFullscreenMode(const GURL& origin) override; | 458 void EnterFullscreenMode(const GURL& origin) override; |
| 459 void ExitFullscreenMode(bool will_cause_resize) override; | 459 void ExitFullscreenMode(bool will_cause_resize) override; |
| 460 bool ShouldRouteMessageEvent( | 460 bool ShouldRouteMessageEvent( |
| 461 RenderFrameHost* target_rfh, | 461 RenderFrameHost* target_rfh, |
| 462 SiteInstance* source_site_instance) const override; | 462 SiteInstance* source_site_instance) const override; |
| 463 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; | 463 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
| 464 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( | 464 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
| 465 const GURL& url) override; | 465 const GURL& url) override; |
| 466 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; | |
| 466 | 467 |
| 467 // RenderViewHostDelegate ---------------------------------------------------- | 468 // RenderViewHostDelegate ---------------------------------------------------- |
| 468 RenderViewHostDelegateView* GetDelegateView() override; | 469 RenderViewHostDelegateView* GetDelegateView() override; |
| 469 bool OnMessageReceived(RenderViewHost* render_view_host, | 470 bool OnMessageReceived(RenderViewHost* render_view_host, |
| 470 const IPC::Message& message) override; | 471 const IPC::Message& message) override; |
| 471 // RenderFrameHostDelegate has the same method, so list it there because this | 472 // RenderFrameHostDelegate has the same method, so list it there because this |
| 472 // interface is going away. | 473 // interface is going away. |
| 473 // WebContents* GetAsWebContents() override; | 474 // WebContents* GetAsWebContents() override; |
| 474 void RenderViewCreated(RenderViewHost* render_view_host) override; | 475 void RenderViewCreated(RenderViewHost* render_view_host) override; |
| 475 void RenderViewReady(RenderViewHost* render_view_host) override; | 476 void RenderViewReady(RenderViewHost* render_view_host) override; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 // | 804 // |
| 804 // Two WebContents with separate FrameTrees can be connected by | 805 // Two WebContents with separate FrameTrees can be connected by |
| 805 // outer/inner relationship using this class. Note that their FrameTrees | 806 // outer/inner relationship using this class. Note that their FrameTrees |
| 806 // still remain disjoint. | 807 // still remain disjoint. |
| 807 // The parent is referred to as "outer WebContents" and the descendents are | 808 // The parent is referred to as "outer WebContents" and the descendents are |
| 808 // referred to as "inner WebContents". | 809 // referred to as "inner WebContents". |
| 809 // For each inner WebContents, the outer WebContents will have a | 810 // For each inner WebContents, the outer WebContents will have a |
| 810 // corresponding FrameTreeNode. | 811 // corresponding FrameTreeNode. |
| 811 struct WebContentsTreeNode { | 812 struct WebContentsTreeNode { |
| 812 public: | 813 public: |
| 813 WebContentsTreeNode(); | 814 explicit WebContentsTreeNode(WebContentsImpl* web_contents); |
| 814 ~WebContentsTreeNode(); | 815 ~WebContentsTreeNode(); |
| 815 | 816 |
| 816 typedef std::set<WebContentsTreeNode*> ChildrenSet; | 817 typedef std::unordered_map<int, WebContentsTreeNode*> ChildrenMap; |
| 817 | 818 |
| 818 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 819 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 819 RenderFrameHostImpl* outer_contents_frame); | 820 RenderFrameHostImpl* outer_contents_frame); |
| 820 | 821 |
| 821 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 822 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 822 int outer_contents_frame_tree_node_id() { | 823 int outer_contents_frame_tree_node_id() const { |
| 823 return outer_contents_frame_tree_node_id_; | 824 return outer_contents_frame_tree_node_id_; |
| 824 } | 825 } |
| 825 | 826 |
| 827 WebContentsImpl* get_focused_web_contents() { | |
|
alexmos
2016/05/26 00:32:25
nit: just focused_web_contents(), mirroring naming
avallee
2016/06/07 15:37:44
Done.
| |
| 828 return focused_web_contents_; | |
| 829 } | |
| 830 | |
| 831 void SetFocusedWebContents(WebContentsImpl* web_contents); | |
| 832 | |
| 826 private: | 833 private: |
| 834 // The WebContents that owns this node. | |
| 835 WebContentsImpl* web_contents_; | |
|
alexmos
2016/05/26 00:32:25
This looks unused now.
avallee
2016/06/07 15:37:44
Removed.
| |
| 827 // The outer WebContents. | 836 // The outer WebContents. |
| 828 WebContentsImpl* outer_web_contents_; | 837 WebContentsImpl* outer_web_contents_; |
| 829 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 838 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 830 int outer_contents_frame_tree_node_id_; | 839 int outer_contents_frame_tree_node_id_; |
| 831 // List of inner WebContents that we host. | 840 // List of inner WebContents, mapped by id of the FrameTreeNode hosting |
| 832 ChildrenSet inner_web_contents_tree_nodes_; | 841 // them. |
| 842 ChildrenMap inner_web_contents_tree_nodes_; | |
|
alexmos
2016/05/26 00:32:26
Is the transformation to use a map here still nece
avallee
2016/06/07 15:37:44
I think it will be necessary for page focus settin
| |
| 843 // Only the root node should have this set. This indicates the WebContents | |
| 844 // whose frame tree has the focused frame. | |
| 845 WebContentsImpl* focused_web_contents_; | |
|
alexmos
2016/05/26 00:32:26
It's unfortunate that we have to keep this around
| |
| 833 }; | 846 }; |
| 834 | 847 |
| 835 // See WebContents::Create for a description of these parameters. | 848 // See WebContents::Create for a description of these parameters. |
| 836 WebContentsImpl(BrowserContext* browser_context); | 849 WebContentsImpl(BrowserContext* browser_context); |
| 837 | 850 |
| 838 // Add and remove observers for page navigation notifications. The order in | 851 // Add and remove observers for page navigation notifications. The order in |
| 839 // which notifications are sent to observers is undefined. Clients must be | 852 // which notifications are sent to observers is undefined. Clients must be |
| 840 // sure to remove the observer before they go away. | 853 // sure to remove the observer before they go away. |
| 841 void AddObserver(WebContentsObserver* observer); | 854 void AddObserver(WebContentsObserver* observer); |
| 842 void RemoveObserver(WebContentsObserver* observer); | 855 void RemoveObserver(WebContentsObserver* observer); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 const base::string16& main_text, | 975 const base::string16& main_text, |
| 963 const base::string16& sub_text); | 976 const base::string16& sub_text); |
| 964 void OnHideValidationMessage(); | 977 void OnHideValidationMessage(); |
| 965 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); | 978 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); |
| 966 | 979 |
| 967 // Called by derived classes to indicate that we're no longer waiting for a | 980 // Called by derived classes to indicate that we're no longer waiting for a |
| 968 // response. This won't actually update the throbber, but it will get picked | 981 // response. This won't actually update the throbber, but it will get picked |
| 969 // up at the next animation step if the throbber is going. | 982 // up at the next animation step if the throbber is going. |
| 970 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 983 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 971 | 984 |
| 985 // Returns the focused WebContents. | |
|
alexmos
2016/05/26 00:32:26
nit: expand a bit on what this is for. I.e., if t
avallee
2016/06/07 15:37:44
Done.
| |
| 986 WebContentsImpl* GetFocusedWebContents(); | |
| 987 | |
| 988 // Returns the root of the WebContents tree. | |
| 989 WebContentsImpl* GetOutermostWebContents(); | |
| 990 | |
| 972 // Navigation helpers -------------------------------------------------------- | 991 // Navigation helpers -------------------------------------------------------- |
| 973 // | 992 // |
| 974 // These functions are helpers for Navigate() and DidNavigate(). | 993 // These functions are helpers for Navigate() and DidNavigate(). |
| 975 | 994 |
| 976 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 995 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 977 // committed to the navigation controller. Note that the navigation entry is | 996 // committed to the navigation controller. Note that the navigation entry is |
| 978 // 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 |
| 979 // current navigation entry is in the NavigationController at this point. | 998 // current navigation entry is in the NavigationController at this point. |
| 980 | 999 |
| 981 // 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1395 // Adds/removes a callback called on creation of each new WebContents. | 1414 // Adds/removes a callback called on creation of each new WebContents. |
| 1396 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1415 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1397 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1416 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1398 | 1417 |
| 1399 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1418 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1400 }; | 1419 }; |
| 1401 | 1420 |
| 1402 } // namespace content | 1421 } // namespace content |
| 1403 | 1422 |
| 1404 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1423 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |