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 WebContentsTreeNode(WebContentsImpl* inner); |
|
alexmos
2016/05/12 20:28:42
nit: explicit?
avallee
2016/05/16 20:26:44
Done.
| |
| 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() const { 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* FindContentsForFrame(int frame_id) { | |
|
alexmos
2016/05/12 20:28:42
This seems to be a FrameTreeNode id, so I'd rename
alexmos
2016/05/12 20:28:43
It might be better to mention "Inner" in the name
avallee
2016/05/16 20:26:44
Did something in that line.
| |
| 828 return const_cast<WebContentsImpl*>( | |
| 829 static_cast<const WebContentsTreeNode*>(this)->FindContentsForFrame( | |
|
alexmos
2016/05/12 20:28:43
This doesn't look like it should be inlined (I thi
avallee
2016/05/16 20:26:44
This is trivial, it compiles down to calling the c
| |
| 830 frame_id)); | |
| 831 } | |
| 832 const WebContentsImpl* FindContentsForFrame(int frame_id) const; | |
|
alexmos
2016/05/12 20:28:42
Are two declarations for this really necessary?
avallee
2016/05/16 20:26:44
Find frame makes sense as a const function, but sh
alexmos
2016/05/19 00:08:09
I wasn't sure myself, so I ran this by nick@ and I
avallee
2016/05/24 20:07:07
Ack.
So even though we implement WebContents, and
| |
| 833 | |
| 826 private: | 834 private: |
| 827 // The outer WebContents. | 835 // The web contents that owns this node |
|
alexmos
2016/05/12 20:28:43
nit: s/web contents/WebContents/
nit: period at th
avallee
2016/05/16 20:26:44
Done.
| |
| 836 WebContentsImpl* const inner_web_contents_; | |
|
alexmos
2016/05/12 20:28:43
I found the naming of this confusing. It sounds s
avallee
2016/05/16 20:26:44
Agreed, done.
| |
| 837 | |
|
alexmos
2016/05/12 20:28:42
nit: either no blank line here, or blank lines sep
avallee
2016/05/16 20:26:44
Done.
| |
| 838 // The outer WebContents | |
| 828 WebContentsImpl* outer_web_contents_; | 839 WebContentsImpl* outer_web_contents_; |
| 829 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 840 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 830 int outer_contents_frame_tree_node_id_; | 841 int outer_contents_frame_tree_node_id_; |
| 831 // List of inner WebContents that we host. | 842 // List of inner WebContents that we host. |
| 832 ChildrenSet inner_web_contents_tree_nodes_; | 843 ChildrenMap inner_web_contents_tree_nodes_; |
| 833 }; | 844 }; |
| 834 | 845 |
| 835 // See WebContents::Create for a description of these parameters. | 846 // See WebContents::Create for a description of these parameters. |
| 836 WebContentsImpl(BrowserContext* browser_context); | 847 WebContentsImpl(BrowserContext* browser_context); |
| 837 | 848 |
| 838 // Add and remove observers for page navigation notifications. The order in | 849 // Add and remove observers for page navigation notifications. The order in |
| 839 // which notifications are sent to observers is undefined. Clients must be | 850 // which notifications are sent to observers is undefined. Clients must be |
| 840 // sure to remove the observer before they go away. | 851 // sure to remove the observer before they go away. |
| 841 void AddObserver(WebContentsObserver* observer); | 852 void AddObserver(WebContentsObserver* observer); |
| 842 void RemoveObserver(WebContentsObserver* observer); | 853 void RemoveObserver(WebContentsObserver* observer); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 const base::string16& main_text, | 973 const base::string16& main_text, |
| 963 const base::string16& sub_text); | 974 const base::string16& sub_text); |
| 964 void OnHideValidationMessage(); | 975 void OnHideValidationMessage(); |
| 965 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); | 976 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); |
| 966 | 977 |
| 967 // Called by derived classes to indicate that we're no longer waiting for a | 978 // 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 | 979 // 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. | 980 // up at the next animation step if the throbber is going. |
| 970 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 981 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 971 | 982 |
| 983 // Called by SetFocusedFrame. Split from SetFocusedFrame to prevent mutual | |
| 984 // recursion from inner to outer web contents. | |
| 985 void SetFocusedFrameInternal(FrameTreeNode* node, | |
| 986 SiteInstance* source, | |
| 987 bool can_visit_outer_contents); | |
| 988 | |
| 972 // Navigation helpers -------------------------------------------------------- | 989 // Navigation helpers -------------------------------------------------------- |
| 973 // | 990 // |
| 974 // These functions are helpers for Navigate() and DidNavigate(). | 991 // These functions are helpers for Navigate() and DidNavigate(). |
| 975 | 992 |
| 976 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 993 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 977 // committed to the navigation controller. Note that the navigation entry is | 994 // committed to the navigation controller. Note that the navigation entry is |
| 978 // not provided since it may be invalid/changed after being committed. The | 995 // not provided since it may be invalid/changed after being committed. The |
| 979 // current navigation entry is in the NavigationController at this point. | 996 // current navigation entry is in the NavigationController at this point. |
| 980 | 997 |
| 981 // If our controller was restored, update the max page ID associated with the | 998 // 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. | 1412 // Adds/removes a callback called on creation of each new WebContents. |
| 1396 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1413 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1397 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1414 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1398 | 1415 |
| 1399 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1416 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1400 }; | 1417 }; |
| 1401 | 1418 |
| 1402 } // namespace content | 1419 } // namespace content |
| 1403 | 1420 |
| 1404 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1421 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |