OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // | 80 // |
81 // Warning: Does not sanity check |index|. | 81 // Warning: Does not sanity check |index|. |
82 InfoBar* infobar_at(size_t index) { return infobars_[index]; } | 82 InfoBar* infobar_at(size_t index) { return infobars_[index]; } |
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 void AddObserver(Observer* obs); | 87 void AddObserver(Observer* obs); |
88 void RemoveObserver(Observer* obs); | 88 void RemoveObserver(Observer* obs); |
89 | 89 |
| 90 // Returns the active entry ID. |
| 91 virtual int GetActiveEntryID() = 0; |
| 92 |
90 protected: | 93 protected: |
91 // Notifies the observer in |observer_list_|. | 94 // Notifies the observer in |observer_list_|. |
92 // TODO(droger): make these methods non-virtual once overrides for | 95 // TODO(droger): make these methods non-virtual once overrides for |
93 // notifications are removed (see http://crbug.com/354380). | 96 // notifications are removed (see http://crbug.com/354380). |
94 virtual void NotifyInfoBarAdded(InfoBar* infobar); | 97 virtual void NotifyInfoBarAdded(InfoBar* infobar); |
95 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); | 98 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); |
96 virtual void NotifyInfoBarReplaced(InfoBar* old_infobar, | 99 virtual void NotifyInfoBarReplaced(InfoBar* old_infobar, |
97 InfoBar* new_infobar); | 100 InfoBar* new_infobar); |
98 void NotifyManagerShuttingDown(); | 101 void NotifyManagerShuttingDown(); |
99 | 102 |
100 private: | 103 private: |
101 // InfoBars associated with this InfoBarManager. We own these pointers. | 104 // InfoBars associated with this InfoBarManager. We own these pointers. |
102 // However, this is not a ScopedVector, because we don't delete the infobars | 105 // However, this is not a ScopedVector, because we don't delete the infobars |
103 // directly once they've been added to this; instead, when we're done with an | 106 // directly once they've been added to this; instead, when we're done with an |
104 // infobar, we instruct it to delete itself and then orphan it. See | 107 // infobar, we instruct it to delete itself and then orphan it. See |
105 // RemoveInfoBarInternal(). | 108 // RemoveInfoBarInternal(). |
106 typedef std::vector<InfoBar*> InfoBars; | 109 typedef std::vector<InfoBar*> InfoBars; |
107 | 110 |
108 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); | 111 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); |
109 | 112 |
110 InfoBars infobars_; | 113 InfoBars infobars_; |
111 bool infobars_enabled_; | 114 bool infobars_enabled_; |
112 | 115 |
113 ObserverList<Observer, true> observer_list_; | 116 ObserverList<Observer, true> observer_list_; |
114 | 117 |
115 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 118 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
116 }; | 119 }; |
117 | 120 |
118 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ | 121 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ |
OLD | NEW |