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): Absorb these methods back into their callers once virtual | 95 // TODO(droger): Absorb these methods back into their callers once virtual |
93 // overrides are removed (see http://crbug.com/354380). | 96 // overrides 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 | 101 |
99 private: | 102 private: |
100 // InfoBars associated with this InfoBarManager. We own these pointers. | 103 // InfoBars associated with this InfoBarManager. We own these pointers. |
101 // However, this is not a ScopedVector, because we don't delete the infobars | 104 // However, this is not a ScopedVector, because we don't delete the infobars |
102 // directly once they've been added to this; instead, when we're done with an | 105 // directly once they've been added to this; instead, when we're done with an |
103 // infobar, we instruct it to delete itself and then orphan it. See | 106 // infobar, we instruct it to delete itself and then orphan it. See |
104 // RemoveInfoBarInternal(). | 107 // RemoveInfoBarInternal(). |
105 typedef std::vector<InfoBar*> InfoBars; | 108 typedef std::vector<InfoBar*> InfoBars; |
106 | 109 |
107 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); | 110 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); |
108 | 111 |
109 InfoBars infobars_; | 112 InfoBars infobars_; |
110 bool infobars_enabled_; | 113 bool infobars_enabled_; |
111 | 114 |
112 ObserverList<Observer, true> observer_list_; | 115 ObserverList<Observer, true> observer_list_; |
113 | 116 |
114 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 117 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
115 }; | 118 }; |
116 | 119 |
117 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ | 120 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ |
OLD | NEW |