| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); | 501 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 502 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); | 502 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
| 503 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); | 503 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); |
| 504 | 504 |
| 505 // So InterstitialPageImpl can access SetIsLoading. | 505 // So InterstitialPageImpl can access SetIsLoading. |
| 506 friend class InterstitialPageImpl; | 506 friend class InterstitialPageImpl; |
| 507 | 507 |
| 508 // TODO(brettw) TestWebContents shouldn't exist! | 508 // TODO(brettw) TestWebContents shouldn't exist! |
| 509 friend class TestWebContents; | 509 friend class TestWebContents; |
| 510 | 510 |
| 511 class DestructionObserver; |
| 512 |
| 511 // See WebContents::Create for a description of these parameters. | 513 // See WebContents::Create for a description of these parameters. |
| 512 WebContentsImpl(BrowserContext* browser_context, | 514 WebContentsImpl(BrowserContext* browser_context, |
| 513 WebContentsImpl* opener); | 515 WebContentsImpl* opener); |
| 514 | 516 |
| 515 // Add and remove observers for page navigation notifications. Adding or | 517 // Add and remove observers for page navigation notifications. Adding or |
| 516 // removing multiple times has no effect. The order in which notifications | 518 // removing multiple times has no effect. The order in which notifications |
| 517 // are sent to observers is undefined. Clients must be sure to remove the | 519 // are sent to observers is undefined. Clients must be sure to remove the |
| 518 // observer before they go away. | 520 // observer before they go away. |
| 519 void AddObserver(WebContentsObserver* observer); | 521 void AddObserver(WebContentsObserver* observer); |
| 520 void RemoveObserver(WebContentsObserver* observer); | 522 void RemoveObserver(WebContentsObserver* observer); |
| 521 | 523 |
| 522 // Clears this tab's opener if it has been closed. | 524 // Clears this tab's opener if it has been closed. |
| 523 void OnWebContentsDestroyed(WebContents* web_contents); | 525 void OnWebContentsDestroyed(WebContentsImpl* web_contents); |
| 526 |
| 527 // Creates and adds to the map a destruction observer watching |web_contents|. |
| 528 // No-op if such an observer already exists. |
| 529 void AddDestructionObserver(WebContentsImpl* web_contents); |
| 530 |
| 531 // Deletes and removes from the map a destruction observer |
| 532 // watching |web_contents|. No-op if there is no such observer. |
| 533 void RemoveDestructionObserver(WebContentsImpl* web_contents); |
| 524 | 534 |
| 525 // Callback function when showing JS dialogs. | 535 // Callback function when showing JS dialogs. |
| 526 void OnDialogClosed(RenderViewHost* rvh, | 536 void OnDialogClosed(RenderViewHost* rvh, |
| 527 IPC::Message* reply_msg, | 537 IPC::Message* reply_msg, |
| 528 bool success, | 538 bool success, |
| 529 const string16& user_input); | 539 const string16& user_input); |
| 530 | 540 |
| 531 // Callback function when requesting permission to access the PPAPI broker. | 541 // Callback function when requesting permission to access the PPAPI broker. |
| 532 // |result| is true if permission was granted. | 542 // |result| is true if permission was granted. |
| 533 void OnPpapiBrokerPermissionResult(int request_id, bool result); | 543 void OnPpapiBrokerPermissionResult(int request_id, bool result); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 // Tracks created WebContentsImpl objects that have not been shown yet. They | 746 // Tracks created WebContentsImpl objects that have not been shown yet. They |
| 737 // are identified by the route ID passed to CreateNewWindow. | 747 // are identified by the route ID passed to CreateNewWindow. |
| 738 typedef std::map<int, WebContentsImpl*> PendingContents; | 748 typedef std::map<int, WebContentsImpl*> PendingContents; |
| 739 PendingContents pending_contents_; | 749 PendingContents pending_contents_; |
| 740 | 750 |
| 741 // These maps hold on to the widgets that we created on behalf of the renderer | 751 // These maps hold on to the widgets that we created on behalf of the renderer |
| 742 // that haven't shown yet. | 752 // that haven't shown yet. |
| 743 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 753 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
| 744 PendingWidgetViews pending_widget_views_; | 754 PendingWidgetViews pending_widget_views_; |
| 745 | 755 |
| 756 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers; |
| 757 DestructionObservers destruction_observers_; |
| 758 |
| 746 // A list of observers notified when page state changes. Weak references. | 759 // A list of observers notified when page state changes. Weak references. |
| 747 // This MUST be listed above render_manager_ since at destruction time the | 760 // This MUST be listed above render_manager_ since at destruction time the |
| 748 // latter might cause RenderViewHost's destructor to call us and we might use | 761 // latter might cause RenderViewHost's destructor to call us and we might use |
| 749 // the observer list then. | 762 // the observer list then. |
| 750 ObserverList<WebContentsObserver> observers_; | 763 ObserverList<WebContentsObserver> observers_; |
| 751 | 764 |
| 752 // The tab that opened this tab, if any. Will be set to null if the opener | 765 // The tab that opened this tab, if any. Will be set to null if the opener |
| 753 // is closed. | 766 // is closed. |
| 754 WebContentsImpl* opener_; | 767 WebContentsImpl* opener_; |
| 755 | 768 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 // Maps the ids of pending image downloads to their callbacks | 928 // Maps the ids of pending image downloads to their callbacks |
| 916 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 929 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
| 917 ImageDownloadMap image_download_map_; | 930 ImageDownloadMap image_download_map_; |
| 918 | 931 |
| 919 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 932 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 920 }; | 933 }; |
| 921 | 934 |
| 922 } // namespace content | 935 } // namespace content |
| 923 | 936 |
| 924 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 937 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |