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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void SetIsCrashed(base::TerminationStatus status, int error_code) override; | 272 void SetIsCrashed(base::TerminationStatus status, int error_code) override; |
273 base::TerminationStatus GetCrashedStatus() const override; | 273 base::TerminationStatus GetCrashedStatus() const override; |
274 bool IsBeingDestroyed() const override; | 274 bool IsBeingDestroyed() const override; |
275 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; | 275 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; |
276 base::TimeTicks GetLastActiveTime() const override; | 276 base::TimeTicks GetLastActiveTime() const override; |
277 void SetLastActiveTime(base::TimeTicks last_active_time) override; | 277 void SetLastActiveTime(base::TimeTicks last_active_time) override; |
278 void WasShown() override; | 278 void WasShown() override; |
279 void WasHidden() override; | 279 void WasHidden() override; |
280 bool NeedToFireBeforeUnload() override; | 280 bool NeedToFireBeforeUnload() override; |
281 void DispatchBeforeUnload(bool for_cross_site_transition) override; | 281 void DispatchBeforeUnload(bool for_cross_site_transition) override; |
| 282 void AttachToOuterWebContentsFrame( |
| 283 WebContents* outer_web_contents, |
| 284 RenderFrameHost* outer_contents_frame) override; |
282 void Stop() override; | 285 void Stop() override; |
283 WebContents* Clone() override; | 286 WebContents* Clone() override; |
284 void ReloadFocusedFrame(bool ignore_cache) override; | 287 void ReloadFocusedFrame(bool ignore_cache) override; |
285 void Undo() override; | 288 void Undo() override; |
286 void Redo() override; | 289 void Redo() override; |
287 void Cut() override; | 290 void Cut() override; |
288 void Copy() override; | 291 void Copy() override; |
289 void CopyToFindPboard() override; | 292 void CopyToFindPboard() override; |
290 void Paste() override; | 293 void Paste() override; |
291 void PasteAndMatchStyle() override; | 294 void PasteAndMatchStyle() override; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 void NotifyMainFrameSwappedFromRenderManager( | 590 void NotifyMainFrameSwappedFromRenderManager( |
588 RenderViewHost* old_host, | 591 RenderViewHost* old_host, |
589 RenderViewHost* new_host) override; | 592 RenderViewHost* new_host) override; |
590 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; | 593 int CreateOpenerRenderViewsForRenderManager(SiteInstance* instance) override; |
591 NavigationControllerImpl& GetControllerForRenderManager() override; | 594 NavigationControllerImpl& GetControllerForRenderManager() override; |
592 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; | 595 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; |
593 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; | 596 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
594 bool FocusLocationBarByDefault() override; | 597 bool FocusLocationBarByDefault() override; |
595 void SetFocusToLocationBar(bool select_all) override; | 598 void SetFocusToLocationBar(bool select_all) override; |
596 bool IsHidden() override; | 599 bool IsHidden() override; |
| 600 int GetOuterDelegateFrameTreeNodeID() override; |
597 | 601 |
598 // NotificationObserver ------------------------------------------------------ | 602 // NotificationObserver ------------------------------------------------------ |
599 | 603 |
600 void Observe(int type, | 604 void Observe(int type, |
601 const NotificationSource& source, | 605 const NotificationSource& source, |
602 const NotificationDetails& details) override; | 606 const NotificationDetails& details) override; |
603 | 607 |
604 // NavigationControllerDelegate ---------------------------------------------- | 608 // NavigationControllerDelegate ---------------------------------------------- |
605 | 609 |
606 WebContents* GetWebContents() override; | 610 WebContents* GetWebContents() override; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 CrossSiteIframeAccessibility); | 722 CrossSiteIframeAccessibility); |
719 | 723 |
720 // So InterstitialPageImpl can access SetIsLoading. | 724 // So InterstitialPageImpl can access SetIsLoading. |
721 friend class InterstitialPageImpl; | 725 friend class InterstitialPageImpl; |
722 | 726 |
723 // TODO(brettw) TestWebContents shouldn't exist! | 727 // TODO(brettw) TestWebContents shouldn't exist! |
724 friend class TestWebContents; | 728 friend class TestWebContents; |
725 | 729 |
726 class DestructionObserver; | 730 class DestructionObserver; |
727 | 731 |
| 732 // Represents a WebContents node in a tree of WebContents structure. |
| 733 // |
| 734 // Two WebContents with separate FrameTrees can be connected by |
| 735 // outer/inner relationship using this class. Note that their FrameTrees |
| 736 // still remain disjoint. |
| 737 // The parent is referred to as "outer WebContents" and the descendents are |
| 738 // referred to as "inner WebContents". |
| 739 struct WebContentsTreeNode { |
| 740 public: |
| 741 WebContentsTreeNode(); |
| 742 ~WebContentsTreeNode(); |
| 743 |
| 744 typedef std::set<WebContentsTreeNode*> ChildrenSet; |
| 745 |
| 746 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 747 RenderFrameHostImpl* outer_contents_frame); |
| 748 |
| 749 int outer_contents_frame_tree_node_id() { |
| 750 return outer_contents_frame_tree_node_id_; |
| 751 } |
| 752 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 753 |
| 754 private: |
| 755 int outer_contents_frame_tree_node_id_; |
| 756 WebContentsImpl* outer_web_contents_; |
| 757 ChildrenSet inner_web_contents_tree_nodes_; |
| 758 }; |
| 759 |
728 // See WebContents::Create for a description of these parameters. | 760 // See WebContents::Create for a description of these parameters. |
729 WebContentsImpl(BrowserContext* browser_context); | 761 WebContentsImpl(BrowserContext* browser_context); |
730 | 762 |
731 // Add and remove observers for page navigation notifications. The order in | 763 // Add and remove observers for page navigation notifications. The order in |
732 // which notifications are sent to observers is undefined. Clients must be | 764 // which notifications are sent to observers is undefined. Clients must be |
733 // sure to remove the observer before they go away. | 765 // sure to remove the observer before they go away. |
734 void AddObserver(WebContentsObserver* observer); | 766 void AddObserver(WebContentsObserver* observer); |
735 void RemoveObserver(WebContentsObserver* observer); | 767 void RemoveObserver(WebContentsObserver* observer); |
736 | 768 |
737 // Clears a pending contents that has been closed before being shown. | 769 // Clears a pending contents that has been closed before being shown. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; | 1061 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; |
1030 | 1062 |
1031 // Tells whether this WebContents is actively producing sound. | 1063 // Tells whether this WebContents is actively producing sound. |
1032 // Order is important: the |frame_tree_| destruction uses | 1064 // Order is important: the |frame_tree_| destruction uses |
1033 // |audio_state_provider_|. | 1065 // |audio_state_provider_|. |
1034 scoped_ptr<AudioStateProvider> audio_state_provider_; | 1066 scoped_ptr<AudioStateProvider> audio_state_provider_; |
1035 | 1067 |
1036 // Manages the frame tree of the page and process swaps in each node. | 1068 // Manages the frame tree of the page and process swaps in each node. |
1037 FrameTree frame_tree_; | 1069 FrameTree frame_tree_; |
1038 | 1070 |
| 1071 // If this WebContents is part of a "tree of WebContents", then this contains |
| 1072 // information about the structure. |
| 1073 scoped_ptr<WebContentsTreeNode> node_; |
| 1074 |
1039 // SavePackage, lazily created. | 1075 // SavePackage, lazily created. |
1040 scoped_refptr<SavePackage> save_package_; | 1076 scoped_refptr<SavePackage> save_package_; |
1041 | 1077 |
1042 // Data for loading state ---------------------------------------------------- | 1078 // Data for loading state ---------------------------------------------------- |
1043 | 1079 |
1044 // Indicates whether we're currently loading a resource. | 1080 // Indicates whether we're currently loading a resource. |
1045 bool is_loading_; | 1081 bool is_loading_; |
1046 | 1082 |
1047 // Indicates whether the current load is to a different document. Only valid | 1083 // Indicates whether the current load is to a different document. Only valid |
1048 // if is_loading_ is true. | 1084 // if is_loading_ is true. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 // Adds/removes a callback called on creation of each new WebContents. | 1311 // Adds/removes a callback called on creation of each new WebContents. |
1276 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1312 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1277 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1313 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1278 | 1314 |
1279 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1315 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1280 }; | 1316 }; |
1281 | 1317 |
1282 } // namespace content | 1318 } // namespace content |
1283 | 1319 |
1284 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1320 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |