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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 void SetIsCrashed(base::TerminationStatus status, int error_code) override; | 276 void SetIsCrashed(base::TerminationStatus status, int error_code) override; |
277 base::TerminationStatus GetCrashedStatus() const override; | 277 base::TerminationStatus GetCrashedStatus() const override; |
278 bool IsBeingDestroyed() const override; | 278 bool IsBeingDestroyed() const override; |
279 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; | 279 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; |
280 base::TimeTicks GetLastActiveTime() const override; | 280 base::TimeTicks GetLastActiveTime() const override; |
281 void SetLastActiveTime(base::TimeTicks last_active_time) override; | 281 void SetLastActiveTime(base::TimeTicks last_active_time) override; |
282 void WasShown() override; | 282 void WasShown() override; |
283 void WasHidden() override; | 283 void WasHidden() override; |
284 bool NeedToFireBeforeUnload() override; | 284 bool NeedToFireBeforeUnload() override; |
285 void DispatchBeforeUnload(bool for_cross_site_transition) override; | 285 void DispatchBeforeUnload(bool for_cross_site_transition) override; |
286 void AttachToOuterWebContentsFrame( | |
287 WebContents* outer_web_contents, | |
288 RenderFrameHost* outer_contents_frame) override; | |
286 void Stop() override; | 289 void Stop() override; |
287 WebContents* Clone() override; | 290 WebContents* Clone() override; |
288 void ReloadFocusedFrame(bool ignore_cache) override; | 291 void ReloadFocusedFrame(bool ignore_cache) override; |
289 void Undo() override; | 292 void Undo() override; |
290 void Redo() override; | 293 void Redo() override; |
291 void Cut() override; | 294 void Cut() override; |
292 void Copy() override; | 295 void Copy() override; |
293 void CopyToFindPboard() override; | 296 void CopyToFindPboard() override; |
294 void Paste() override; | 297 void Paste() override; |
295 void PasteAndMatchStyle() override; | 298 void PasteAndMatchStyle() override; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 void NotifyMainFrameSwappedFromRenderManager( | 594 void NotifyMainFrameSwappedFromRenderManager( |
592 RenderViewHost* old_host, | 595 RenderViewHost* old_host, |
593 RenderViewHost* new_host) override; | 596 RenderViewHost* new_host) override; |
594 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; | 597 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; |
595 NavigationControllerImpl& GetControllerForRenderManager() override; | 598 NavigationControllerImpl& GetControllerForRenderManager() override; |
596 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; | 599 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; |
597 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; | 600 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
598 bool FocusLocationBarByDefault() override; | 601 bool FocusLocationBarByDefault() override; |
599 void SetFocusToLocationBar(bool select_all) override; | 602 void SetFocusToLocationBar(bool select_all) override; |
600 bool IsHidden() override; | 603 bool IsHidden() override; |
604 int GetOuterDelegateFrameTreeNodeID() override; | |
601 | 605 |
602 // NotificationObserver ------------------------------------------------------ | 606 // NotificationObserver ------------------------------------------------------ |
603 | 607 |
604 void Observe(int type, | 608 void Observe(int type, |
605 const NotificationSource& source, | 609 const NotificationSource& source, |
606 const NotificationDetails& details) override; | 610 const NotificationDetails& details) override; |
607 | 611 |
608 // NavigationControllerDelegate ---------------------------------------------- | 612 // NavigationControllerDelegate ---------------------------------------------- |
609 | 613 |
610 WebContents* GetWebContents() override; | 614 WebContents* GetWebContents() override; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 CrossSiteIframeAccessibility); | 726 CrossSiteIframeAccessibility); |
723 | 727 |
724 // So InterstitialPageImpl can access SetIsLoading. | 728 // So InterstitialPageImpl can access SetIsLoading. |
725 friend class InterstitialPageImpl; | 729 friend class InterstitialPageImpl; |
726 | 730 |
727 // TODO(brettw) TestWebContents shouldn't exist! | 731 // TODO(brettw) TestWebContents shouldn't exist! |
728 friend class TestWebContents; | 732 friend class TestWebContents; |
729 | 733 |
730 class DestructionObserver; | 734 class DestructionObserver; |
731 | 735 |
736 // Represents a WebContents node in a tree of WebContents structure. | |
737 // | |
738 // Two WebContents with separate FrameTrees can be connected by | |
739 // outer/inner relationship using this class. Note that their FrameTrees | |
740 // still remain disjoint. | |
741 // The root is referred to as "outer WebContents" and the descendents are | |
742 // referred to as "inner WebContents". | |
743 struct WebContentsTreeNode { | |
744 public: | |
745 WebContentsTreeNode(); | |
746 ~WebContentsTreeNode(); | |
747 | |
748 typedef std::set<WebContentsTreeNode*> ChildrenList; | |
Charlie Reis
2015/06/02 18:19:14
set != list
Will we ever care about the order of
lazyboy
2015/06/02 20:15:21
Changed the typedef to ChildrenSet.
Charlie Reis
2015/06/02 23:55:43
No, a set is fine if we don't care about the order
| |
749 | |
750 void SetOuterWebContents(WebContentsImpl* outer_web_contents); | |
751 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | |
752 | |
753 private: | |
754 WebContentsImpl* outer_web_contents_; | |
755 ChildrenList inner_web_contents_tree_nodes_; | |
756 }; | |
757 | |
732 // See WebContents::Create for a description of these parameters. | 758 // See WebContents::Create for a description of these parameters. |
733 WebContentsImpl(BrowserContext* browser_context, | 759 WebContentsImpl(BrowserContext* browser_context, |
734 WebContentsImpl* opener); | 760 WebContentsImpl* opener); |
735 | 761 |
736 // Add and remove observers for page navigation notifications. The order in | 762 // Add and remove observers for page navigation notifications. The order in |
737 // which notifications are sent to observers is undefined. Clients must be | 763 // which notifications are sent to observers is undefined. Clients must be |
738 // sure to remove the observer before they go away. | 764 // sure to remove the observer before they go away. |
739 void AddObserver(WebContentsObserver* observer); | 765 void AddObserver(WebContentsObserver* observer); |
740 void RemoveObserver(WebContentsObserver* observer); | 766 void RemoveObserver(WebContentsObserver* observer); |
741 | 767 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1038 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; | 1064 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; |
1039 | 1065 |
1040 // Tells whether this WebContents is actively producing sound. | 1066 // Tells whether this WebContents is actively producing sound. |
1041 // Order is important: the |frame_tree_| destruction uses | 1067 // Order is important: the |frame_tree_| destruction uses |
1042 // |audio_state_provider_|. | 1068 // |audio_state_provider_|. |
1043 scoped_ptr<AudioStateProvider> audio_state_provider_; | 1069 scoped_ptr<AudioStateProvider> audio_state_provider_; |
1044 | 1070 |
1045 // Manages the frame tree of the page and process swaps in each node. | 1071 // Manages the frame tree of the page and process swaps in each node. |
1046 FrameTree frame_tree_; | 1072 FrameTree frame_tree_; |
1047 | 1073 |
1074 // If this WebContents is part of a "tree of WebContents", then this contains | |
1075 // information about the structure. | |
1076 WebContentsTreeNode node_; | |
Charlie Reis
2015/06/02 18:19:14
Should this be a pointer instead of inline? The v
lazyboy
2015/06/02 20:15:21
Changed to scoped_ptr.
| |
1077 | |
1048 // SavePackage, lazily created. | 1078 // SavePackage, lazily created. |
1049 scoped_refptr<SavePackage> save_package_; | 1079 scoped_refptr<SavePackage> save_package_; |
1050 | 1080 |
1051 // Data for loading state ---------------------------------------------------- | 1081 // Data for loading state ---------------------------------------------------- |
1052 | 1082 |
1053 // Indicates whether we're currently loading a resource. | 1083 // Indicates whether we're currently loading a resource. |
1054 bool is_loading_; | 1084 bool is_loading_; |
1055 | 1085 |
1056 // Indicates whether the current load is to a different document. Only valid | 1086 // Indicates whether the current load is to a different document. Only valid |
1057 // if is_loading_ is true. | 1087 // if is_loading_ is true. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1281 // Adds/removes a callback called on creation of each new WebContents. | 1311 // Adds/removes a callback called on creation of each new WebContents. |
1282 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1312 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1283 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1313 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1284 | 1314 |
1285 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1315 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1286 }; | 1316 }; |
1287 | 1317 |
1288 } // namespace content | 1318 } // namespace content |
1289 | 1319 |
1290 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1320 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |