Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 14651029: content: Remove usage of NOTIFICATION_WEB_CONTENTS_DESTROYED from content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); 497 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
498 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); 498 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
499 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); 499 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
500 500
501 // So InterstitialPageImpl can access SetIsLoading. 501 // So InterstitialPageImpl can access SetIsLoading.
502 friend class InterstitialPageImpl; 502 friend class InterstitialPageImpl;
503 503
504 // TODO(brettw) TestWebContents shouldn't exist! 504 // TODO(brettw) TestWebContents shouldn't exist!
505 friend class TestWebContents; 505 friend class TestWebContents;
506 506
507 class DestructionObserver;
508
507 // See WebContents::Create for a description of these parameters. 509 // See WebContents::Create for a description of these parameters.
508 WebContentsImpl(BrowserContext* browser_context, 510 WebContentsImpl(BrowserContext* browser_context,
509 WebContentsImpl* opener); 511 WebContentsImpl* opener);
510 512
511 // Add and remove observers for page navigation notifications. Adding or 513 // Add and remove observers for page navigation notifications. Adding or
512 // removing multiple times has no effect. The order in which notifications 514 // removing multiple times has no effect. The order in which notifications
513 // are sent to observers is undefined. Clients must be sure to remove the 515 // are sent to observers is undefined. Clients must be sure to remove the
514 // observer before they go away. 516 // observer before they go away.
515 void AddObserver(WebContentsObserver* observer); 517 void AddObserver(WebContentsObserver* observer);
516 void RemoveObserver(WebContentsObserver* observer); 518 void RemoveObserver(WebContentsObserver* observer);
517 519
518 // Clears this tab's opener if it has been closed. 520 // Clears this tab's opener if it has been closed.
519 void OnWebContentsDestroyed(WebContents* web_contents); 521 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
522
523 // Creats and adds to the map a destruction observer watching |web_contents|.
524 // No-op if such an observer already exists.
525 void AddDestructionObserver(WebContentsImpl* web_contents);
526
527 // Deletes and removes from the map a destruction observer
528 // watching |web_contents|. No-op if there is no such observer.
529 void RemoveDestructionObserver(WebContentsImpl* web_contents);
520 530
521 // Callback function when showing JS dialogs. 531 // Callback function when showing JS dialogs.
522 void OnDialogClosed(RenderViewHost* rvh, 532 void OnDialogClosed(RenderViewHost* rvh,
523 IPC::Message* reply_msg, 533 IPC::Message* reply_msg,
524 bool success, 534 bool success,
525 const string16& user_input); 535 const string16& user_input);
526 536
527 // Callback function when requesting permission to access the PPAPI broker. 537 // Callback function when requesting permission to access the PPAPI broker.
528 // |result| is true if permission was granted. 538 // |result| is true if permission was granted.
529 void OnPpapiBrokerPermissionResult(int request_id, bool result); 539 void OnPpapiBrokerPermissionResult(int request_id, bool result);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 // Tracks created WebContentsImpl objects that have not been shown yet. They 740 // Tracks created WebContentsImpl objects that have not been shown yet. They
731 // are identified by the route ID passed to CreateNewWindow. 741 // are identified by the route ID passed to CreateNewWindow.
732 typedef std::map<int, WebContentsImpl*> PendingContents; 742 typedef std::map<int, WebContentsImpl*> PendingContents;
733 PendingContents pending_contents_; 743 PendingContents pending_contents_;
734 744
735 // These maps hold on to the widgets that we created on behalf of the renderer 745 // These maps hold on to the widgets that we created on behalf of the renderer
736 // that haven't shown yet. 746 // that haven't shown yet.
737 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; 747 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
738 PendingWidgetViews pending_widget_views_; 748 PendingWidgetViews pending_widget_views_;
739 749
750 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers;
751 DestructionObservers destruction_observers_;
752
740 // A list of observers notified when page state changes. Weak references. 753 // A list of observers notified when page state changes. Weak references.
741 // This MUST be listed above render_manager_ since at destruction time the 754 // This MUST be listed above render_manager_ since at destruction time the
742 // latter might cause RenderViewHost's destructor to call us and we might use 755 // latter might cause RenderViewHost's destructor to call us and we might use
743 // the observer list then. 756 // the observer list then.
744 ObserverList<WebContentsObserver> observers_; 757 ObserverList<WebContentsObserver> observers_;
745 758
746 // The tab that opened this tab, if any. Will be set to null if the opener 759 // The tab that opened this tab, if any. Will be set to null if the opener
747 // is closed. 760 // is closed.
748 WebContentsImpl* opener_; 761 WebContentsImpl* opener_;
749 762
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 // Maps the ids of pending image downloads to their callbacks 922 // Maps the ids of pending image downloads to their callbacks
910 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; 923 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
911 ImageDownloadMap image_download_map_; 924 ImageDownloadMap image_download_map_;
912 925
913 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 926 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
914 }; 927 };
915 928
916 } // namespace content 929 } // namespace content
917 930
918 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 931 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698