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 COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 6 #define COMPONENTS_INFOBARS_CORE_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" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "components/infobars/core/infobar_delegate.h" | 12 #include "components/infobars/core/infobar_delegate.h" |
13 | 13 |
14 class ConfirmInfoBarDelegate; | |
15 | |
14 namespace content { | 16 namespace content { |
15 class WebContents; | 17 class WebContents; |
16 } | 18 } |
17 | 19 |
18 namespace infobars { | 20 namespace infobars { |
19 | 21 |
20 class InfoBar; | 22 class InfoBar; |
21 | 23 |
22 // Provides access to creating, removing and enumerating info bars | 24 // Provides access to creating, removing and enumerating info bars |
23 // attached to a tab. | 25 // attached to a tab. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 virtual int GetActiveEntryID() = 0; | 97 virtual int GetActiveEntryID() = 0; |
96 | 98 |
97 protected: | 99 protected: |
98 // Notifies the observer in |observer_list_|. | 100 // Notifies the observer in |observer_list_|. |
99 // TODO(droger): Absorb these methods back into their callers once virtual | 101 // TODO(droger): Absorb these methods back into their callers once virtual |
100 // overrides are removed (see http://crbug.com/354380). | 102 // overrides are removed (see http://crbug.com/354380). |
101 virtual void NotifyInfoBarAdded(InfoBar* infobar); | 103 virtual void NotifyInfoBarAdded(InfoBar* infobar); |
102 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); | 104 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); |
103 | 105 |
104 private: | 106 private: |
107 // ConfirmInfoBarDelegate is a friend to be able to call CreateConfirmInfoBar. | |
108 friend class ::ConfirmInfoBarDelegate; | |
109 | |
105 // InfoBars associated with this InfoBarManager. We own these pointers. | 110 // InfoBars associated with this InfoBarManager. We own these pointers. |
106 // However, this is not a ScopedVector, because we don't delete the infobars | 111 // However, this is not a ScopedVector, because we don't delete the infobars |
107 // directly once they've been added to this; instead, when we're done with an | 112 // directly once they've been added to this; instead, when we're done with an |
108 // infobar, we instruct it to delete itself and then orphan it. See | 113 // infobar, we instruct it to delete itself and then orphan it. See |
109 // RemoveInfoBarInternal(). | 114 // RemoveInfoBarInternal(). |
110 typedef std::vector<InfoBar*> InfoBars; | 115 typedef std::vector<InfoBar*> InfoBars; |
111 | 116 |
112 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); | 117 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); |
113 | 118 |
119 // Returns a confirm infobar that owns |delegate|. Must only be called by | |
120 // CreateConfirmInfoBar and allow the embedder to provides an implementation | |
121 // of ConfirmInfoBar. | |
Peter Kasting
2014/12/18 19:23:02
This comment is super-confused grammatically and c
sdefresne
2014/12/19 11:06:15
Ack. English is hard!
| |
122 virtual scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar( | |
123 scoped_ptr<ConfirmInfoBarDelegate> delegate) = 0; | |
124 | |
114 InfoBars infobars_; | 125 InfoBars infobars_; |
115 bool infobars_enabled_; | 126 bool infobars_enabled_; |
116 | 127 |
117 ObserverList<Observer, true> observer_list_; | 128 ObserverList<Observer, true> observer_list_; |
118 | 129 |
119 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 130 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
120 }; | 131 }; |
121 | 132 |
122 } // namespace infobars | 133 } // namespace infobars |
123 | 134 |
124 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 135 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
OLD | NEW |