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

Side by Side Diff: chrome/browser/infobars/infobar_manager.h

Issue 228293004: InfoBarService inherits from InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes Created 6 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 24 matching lines...) Expand all
35 ~InfoBarManager(); 35 ~InfoBarManager();
36 36
37 // Adds the specified |infobar|, which already owns a delegate. 37 // Adds the specified |infobar|, which already owns a delegate.
38 // 38 //
39 // If infobars are disabled for this tab or the tab already has an infobar 39 // If infobars are disabled for this tab or the tab already has an infobar
40 // whose delegate returns true for 40 // whose delegate returns true for
41 // InfoBarDelegate::EqualsDelegate(infobar->delegate()), |infobar| is deleted 41 // InfoBarDelegate::EqualsDelegate(infobar->delegate()), |infobar| is deleted
42 // immediately without being added. 42 // immediately without being added.
43 // 43 //
44 // Returns the infobar if it was successfully added. 44 // Returns the infobar if it was successfully added.
45 virtual InfoBar* AddInfoBar(scoped_ptr<InfoBar> infobar); 45 InfoBar* AddInfoBar(scoped_ptr<InfoBar> infobar);
46 46
47 // Removes the specified |infobar|. This in turn may close immediately or 47 // Removes the specified |infobar|. This in turn may close immediately or
48 // animate closed; at the end the infobar will delete itself. 48 // animate closed; at the end the infobar will delete itself.
49 // 49 //
50 // If infobars are disabled for this tab, this will do nothing, on the 50 // If infobars are disabled for this tab, this will do nothing, on the
51 // assumption that the matching AddInfoBar() call will have already deleted 51 // assumption that the matching AddInfoBar() call will have already deleted
52 // the infobar (see above). 52 // the infobar (see above).
53 void RemoveInfoBar(InfoBar* infobar); 53 void RemoveInfoBar(InfoBar* infobar);
54 54
55 // Removes all the infobars. 55 // Removes all the infobars.
(...skipping 27 matching lines...) Expand all
83 83
84 // Must be called when a navigation happens. 84 // Must be called when a navigation happens.
85 void OnNavigation(const InfoBarDelegate::NavigationDetails& details); 85 void OnNavigation(const InfoBarDelegate::NavigationDetails& details);
86 86
87 // Called when the associated WebContents is being destroyed. 87 // Called when the associated WebContents is being destroyed.
88 void OnWebContentsDestroyed(); 88 void OnWebContentsDestroyed();
89 89
90 void AddObserver(Observer* obs); 90 void AddObserver(Observer* obs);
91 void RemoveObserver(Observer* obs); 91 void RemoveObserver(Observer* obs);
92 92
93 protected:
94 // Notifies the observer in |observer_list_|.
95 virtual void NotifyInfoBarAdded(InfoBar* infobar);
96 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate);
97 virtual void NotifyInfoBarReplaced(InfoBar* old_infobar,
98 InfoBar* new_infobar);
99 void NotifyManagerShuttingDown();
100
93 private: 101 private:
94 // InfoBars associated with this InfoBarManager. We own these pointers. 102 // InfoBars associated with this InfoBarManager. We own these pointers.
95 // However, this is not a ScopedVector, because we don't delete the infobars 103 // However, this is not a ScopedVector, because we don't delete the infobars
96 // directly once they've been added to this; instead, when we're done with an 104 // directly once they've been added to this; instead, when we're done with an
97 // infobar, we instruct it to delete itself and then orphan it. See 105 // infobar, we instruct it to delete itself and then orphan it. See
98 // RemoveInfoBarInternal(). 106 // RemoveInfoBarInternal().
99 typedef std::vector<InfoBar*> InfoBars; 107 typedef std::vector<InfoBar*> InfoBars;
100 108
101 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); 109 void RemoveInfoBarInternal(InfoBar* infobar, bool animate);
102 110
103 InfoBars infobars_; 111 InfoBars infobars_;
104 bool infobars_enabled_; 112 bool infobars_enabled_;
105 113
106 // TODO(droger): remove this field. See http://crbug.com/354379. 114 // TODO(droger): remove this field. See http://crbug.com/354379.
107 content::WebContents* web_contents_; 115 content::WebContents* web_contents_;
108 116
109 ObserverList<Observer, true> observer_list_; 117 ObserverList<Observer, true> observer_list_;
110 118
111 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); 119 DISALLOW_COPY_AND_ASSIGN(InfoBarManager);
112 }; 120 };
113 121
114 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ 122 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698