| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 bool is_main_frame) override; | 589 bool is_main_frame) override; |
| 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 NavigationControllerImpl& GetControllerForRenderManager() override; | 593 NavigationControllerImpl& GetControllerForRenderManager() override; |
| 591 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; | 594 scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(const GURL& url) override; |
| 592 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; | 595 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
| 593 bool FocusLocationBarByDefault() override; | 596 bool FocusLocationBarByDefault() override; |
| 594 void SetFocusToLocationBar(bool select_all) override; | 597 void SetFocusToLocationBar(bool select_all) override; |
| 595 bool IsHidden() override; | 598 bool IsHidden() override; |
| 599 int GetOuterDelegateFrameTreeNodeID() override; |
| 596 | 600 |
| 597 // NotificationObserver ------------------------------------------------------ | 601 // NotificationObserver ------------------------------------------------------ |
| 598 | 602 |
| 599 void Observe(int type, | 603 void Observe(int type, |
| 600 const NotificationSource& source, | 604 const NotificationSource& source, |
| 601 const NotificationDetails& details) override; | 605 const NotificationDetails& details) override; |
| 602 | 606 |
| 603 // NavigationControllerDelegate ---------------------------------------------- | 607 // NavigationControllerDelegate ---------------------------------------------- |
| 604 | 608 |
| 605 WebContents* GetWebContents() override; | 609 WebContents* GetWebContents() override; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 CrossSiteIframeAccessibility); | 708 CrossSiteIframeAccessibility); |
| 705 | 709 |
| 706 // So InterstitialPageImpl can access SetIsLoading. | 710 // So InterstitialPageImpl can access SetIsLoading. |
| 707 friend class InterstitialPageImpl; | 711 friend class InterstitialPageImpl; |
| 708 | 712 |
| 709 // TODO(brettw) TestWebContents shouldn't exist! | 713 // TODO(brettw) TestWebContents shouldn't exist! |
| 710 friend class TestWebContents; | 714 friend class TestWebContents; |
| 711 | 715 |
| 712 class DestructionObserver; | 716 class DestructionObserver; |
| 713 | 717 |
| 718 // Represents a WebContents node in a tree of WebContents structure. |
| 719 // |
| 720 // Two WebContents with separate FrameTrees can be connected by |
| 721 // outer/inner relationship using this class. Note that their FrameTrees |
| 722 // still remain disjoint. |
| 723 // The parent is referred to as "outer WebContents" and the descendents are |
| 724 // referred to as "inner WebContents". |
| 725 // For each inner WebContents, the outer WebContents will have a |
| 726 // corresponding FrameTreeNode. |
| 727 struct WebContentsTreeNode { |
| 728 public: |
| 729 WebContentsTreeNode(); |
| 730 ~WebContentsTreeNode(); |
| 731 |
| 732 typedef std::set<WebContentsTreeNode*> ChildrenSet; |
| 733 |
| 734 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 735 RenderFrameHostImpl* outer_contents_frame); |
| 736 |
| 737 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 738 int outer_contents_frame_tree_node_id() { |
| 739 return outer_contents_frame_tree_node_id_; |
| 740 } |
| 741 |
| 742 private: |
| 743 // The outer Webontents. |
| 744 WebContentsImpl* outer_web_contents_; |
| 745 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 746 int outer_contents_frame_tree_node_id_; |
| 747 // List of inner WebContents that we host. |
| 748 ChildrenSet inner_web_contents_tree_nodes_; |
| 749 }; |
| 750 |
| 714 // See WebContents::Create for a description of these parameters. | 751 // See WebContents::Create for a description of these parameters. |
| 715 WebContentsImpl(BrowserContext* browser_context); | 752 WebContentsImpl(BrowserContext* browser_context); |
| 716 | 753 |
| 717 // Add and remove observers for page navigation notifications. The order in | 754 // Add and remove observers for page navigation notifications. The order in |
| 718 // which notifications are sent to observers is undefined. Clients must be | 755 // which notifications are sent to observers is undefined. Clients must be |
| 719 // sure to remove the observer before they go away. | 756 // sure to remove the observer before they go away. |
| 720 void AddObserver(WebContentsObserver* observer); | 757 void AddObserver(WebContentsObserver* observer); |
| 721 void RemoveObserver(WebContentsObserver* observer); | 758 void RemoveObserver(WebContentsObserver* observer); |
| 722 | 759 |
| 723 // Clears a pending contents that has been closed before being shown. | 760 // Clears a pending contents that has been closed before being shown. |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; | 1046 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; |
| 1010 | 1047 |
| 1011 // Tells whether this WebContents is actively producing sound. | 1048 // Tells whether this WebContents is actively producing sound. |
| 1012 // Order is important: the |frame_tree_| destruction uses | 1049 // Order is important: the |frame_tree_| destruction uses |
| 1013 // |audio_state_provider_|. | 1050 // |audio_state_provider_|. |
| 1014 scoped_ptr<AudioStateProvider> audio_state_provider_; | 1051 scoped_ptr<AudioStateProvider> audio_state_provider_; |
| 1015 | 1052 |
| 1016 // Manages the frame tree of the page and process swaps in each node. | 1053 // Manages the frame tree of the page and process swaps in each node. |
| 1017 FrameTree frame_tree_; | 1054 FrameTree frame_tree_; |
| 1018 | 1055 |
| 1056 // If this WebContents is part of a "tree of WebContents", then this contains |
| 1057 // information about the structure. |
| 1058 scoped_ptr<WebContentsTreeNode> node_; |
| 1059 |
| 1019 // SavePackage, lazily created. | 1060 // SavePackage, lazily created. |
| 1020 scoped_refptr<SavePackage> save_package_; | 1061 scoped_refptr<SavePackage> save_package_; |
| 1021 | 1062 |
| 1022 // Data for loading state ---------------------------------------------------- | 1063 // Data for loading state ---------------------------------------------------- |
| 1023 | 1064 |
| 1024 // Indicates whether we're currently loading a resource. | 1065 // Indicates whether we're currently loading a resource. |
| 1025 bool is_loading_; | 1066 bool is_loading_; |
| 1026 | 1067 |
| 1027 // Indicates whether the current load is to a different document. Only valid | 1068 // Indicates whether the current load is to a different document. Only valid |
| 1028 // if is_loading_ is true. | 1069 // if is_loading_ is true. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 // Adds/removes a callback called on creation of each new WebContents. | 1296 // Adds/removes a callback called on creation of each new WebContents. |
| 1256 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1297 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1257 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1298 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1258 | 1299 |
| 1259 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1300 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1260 }; | 1301 }; |
| 1261 | 1302 |
| 1262 } // namespace content | 1303 } // namespace content |
| 1263 | 1304 |
| 1264 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1305 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |