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