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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 void NotifyMainFrameSwappedFromRenderManager( | 595 void NotifyMainFrameSwappedFromRenderManager( |
593 RenderViewHost* old_host, | 596 RenderViewHost* old_host, |
594 RenderViewHost* new_host) override; | 597 RenderViewHost* new_host) override; |
595 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; | 598 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; |
596 NavigationControllerImpl& GetControllerForRenderManager() override; | 599 NavigationControllerImpl& GetControllerForRenderManager() override; |
597 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; | 600 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; |
598 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; | 601 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
599 bool FocusLocationBarByDefault() override; | 602 bool FocusLocationBarByDefault() override; |
600 void SetFocusToLocationBar(bool select_all) override; | 603 void SetFocusToLocationBar(bool select_all) override; |
601 bool IsHidden() override; | 604 bool IsHidden() override; |
| 605 int GetOuterDelegateFrameTreeNodeID() override; |
602 | 606 |
603 // NotificationObserver ------------------------------------------------------ | 607 // NotificationObserver ------------------------------------------------------ |
604 | 608 |
605 void Observe(int type, | 609 void Observe(int type, |
606 const NotificationSource& source, | 610 const NotificationSource& source, |
607 const NotificationDetails& details) override; | 611 const NotificationDetails& details) override; |
608 | 612 |
609 // NavigationControllerDelegate ---------------------------------------------- | 613 // NavigationControllerDelegate ---------------------------------------------- |
610 | 614 |
611 WebContents* GetWebContents() override; | 615 WebContents* GetWebContents() override; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 CrossSiteIframeAccessibility); | 727 CrossSiteIframeAccessibility); |
724 | 728 |
725 // So InterstitialPageImpl can access SetIsLoading. | 729 // So InterstitialPageImpl can access SetIsLoading. |
726 friend class InterstitialPageImpl; | 730 friend class InterstitialPageImpl; |
727 | 731 |
728 // TODO(brettw) TestWebContents shouldn't exist! | 732 // TODO(brettw) TestWebContents shouldn't exist! |
729 friend class TestWebContents; | 733 friend class TestWebContents; |
730 | 734 |
731 class DestructionObserver; | 735 class DestructionObserver; |
732 | 736 |
| 737 // Represents a WebContents node in a tree of WebContents structure. |
| 738 // |
| 739 // Two WebContents with separate FrameTrees can be connected by |
| 740 // outer/inner relationship using this class. Note that their FrameTrees |
| 741 // still remain disjoint. |
| 742 // The root is referred to as "outer WebContents" and the descendents are |
| 743 // referred to as "inner WebContents". |
| 744 struct WebContentsTreeNode { |
| 745 public: |
| 746 WebContentsTreeNode(); |
| 747 ~WebContentsTreeNode(); |
| 748 |
| 749 typedef std::set<WebContentsTreeNode*> ChildrenSet; |
| 750 |
| 751 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 752 RenderFrameHostImpl* outer_contents_frame); |
| 753 |
| 754 int outer_contents_frame_tree_node_id() { |
| 755 return outer_contents_frame_tree_node_id_; |
| 756 } |
| 757 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 758 |
| 759 private: |
| 760 int outer_contents_frame_tree_node_id_; |
| 761 WebContentsImpl* outer_web_contents_; |
| 762 ChildrenSet inner_web_contents_tree_nodes_; |
| 763 }; |
| 764 |
733 // See WebContents::Create for a description of these parameters. | 765 // See WebContents::Create for a description of these parameters. |
734 WebContentsImpl(BrowserContext* browser_context, | 766 WebContentsImpl(BrowserContext* browser_context, |
735 WebContentsImpl* opener); | 767 WebContentsImpl* opener); |
736 | 768 |
737 // Add and remove observers for page navigation notifications. The order in | 769 // Add and remove observers for page navigation notifications. The order in |
738 // which notifications are sent to observers is undefined. Clients must be | 770 // which notifications are sent to observers is undefined. Clients must be |
739 // sure to remove the observer before they go away. | 771 // sure to remove the observer before they go away. |
740 void AddObserver(WebContentsObserver* observer); | 772 void AddObserver(WebContentsObserver* observer); |
741 void RemoveObserver(WebContentsObserver* observer); | 773 void RemoveObserver(WebContentsObserver* observer); |
742 | 774 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; | 1071 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; |
1040 | 1072 |
1041 // Tells whether this WebContents is actively producing sound. | 1073 // Tells whether this WebContents is actively producing sound. |
1042 // Order is important: the |frame_tree_| destruction uses | 1074 // Order is important: the |frame_tree_| destruction uses |
1043 // |audio_state_provider_|. | 1075 // |audio_state_provider_|. |
1044 scoped_ptr<AudioStateProvider> audio_state_provider_; | 1076 scoped_ptr<AudioStateProvider> audio_state_provider_; |
1045 | 1077 |
1046 // Manages the frame tree of the page and process swaps in each node. | 1078 // Manages the frame tree of the page and process swaps in each node. |
1047 FrameTree frame_tree_; | 1079 FrameTree frame_tree_; |
1048 | 1080 |
| 1081 // If this WebContents is part of a "tree of WebContents", then this contains |
| 1082 // information about the structure. |
| 1083 scoped_ptr<WebContentsTreeNode> node_; |
| 1084 |
1049 // SavePackage, lazily created. | 1085 // SavePackage, lazily created. |
1050 scoped_refptr<SavePackage> save_package_; | 1086 scoped_refptr<SavePackage> save_package_; |
1051 | 1087 |
1052 // Data for loading state ---------------------------------------------------- | 1088 // Data for loading state ---------------------------------------------------- |
1053 | 1089 |
1054 // Indicates whether we're currently loading a resource. | 1090 // Indicates whether we're currently loading a resource. |
1055 bool is_loading_; | 1091 bool is_loading_; |
1056 | 1092 |
1057 // Indicates whether the current load is to a different document. Only valid | 1093 // Indicates whether the current load is to a different document. Only valid |
1058 // if is_loading_ is true. | 1094 // if is_loading_ is true. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 // Adds/removes a callback called on creation of each new WebContents. | 1321 // Adds/removes a callback called on creation of each new WebContents. |
1286 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1322 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1287 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1323 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1288 | 1324 |
1289 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1325 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1290 }; | 1326 }; |
1291 | 1327 |
1292 } // namespace content | 1328 } // namespace content |
1293 | 1329 |
1294 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1330 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |