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 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace infobars { | 18 namespace infobars { |
19 | 19 |
20 class InfoBar; | 20 class InfoBar; |
21 | 21 |
22 // Provides access to creating, removing and enumerating info bars | 22 // Provides access to creating, removing and enumerating info bars |
23 // attached to a tab. | 23 // attached to a tab. |
24 class InfoBarManager { | 24 class InfoBarManager { |
25 public: | 25 public: |
26 // Observer class for infobar events. | 26 // Observer class for infobar events. |
27 class Observer { | 27 class Observer { |
28 public: | 28 public: |
29 virtual void OnInfoBarAdded(InfoBar* infobar) = 0; | 29 virtual void OnInfoBarAdded(InfoBar* infobar) {} |
30 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) = 0; | 30 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) {} |
31 virtual void OnInfoBarReplaced(InfoBar* old_infobar, | 31 virtual void OnInfoBarReplaced(InfoBar* old_infobar, |
32 InfoBar* new_infobar) = 0; | 32 InfoBar* new_infobar) {} |
33 virtual void OnManagerShuttingDown(InfoBarManager* manager) = 0; | 33 virtual void OnManagerShuttingDown(InfoBarManager* manager) {} |
Peter Kasting
2014/04/21 20:34:06
Nit: We shouldn't define virtual functions inline.
tfarina
2014/04/21 20:56:40
Done.
| |
34 }; | 34 }; |
35 | 35 |
36 InfoBarManager(); | 36 InfoBarManager(); |
37 virtual ~InfoBarManager(); | 37 virtual ~InfoBarManager(); |
38 | 38 |
39 // Must be called before destruction. | 39 // Must be called before destruction. |
40 // TODO(droger): Merge this method with the destructor once the virtual calls | 40 // TODO(droger): Merge this method with the destructor once the virtual calls |
41 // for notifications are removed (see http://crbug.com/354380). | 41 // for notifications are removed (see http://crbug.com/354380). |
42 void ShutDown(); | 42 void ShutDown(); |
43 | 43 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 bool infobars_enabled_; | 115 bool infobars_enabled_; |
116 | 116 |
117 ObserverList<Observer, true> observer_list_; | 117 ObserverList<Observer, true> observer_list_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 119 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace infobars | 122 } // namespace infobars |
123 | 123 |
124 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 124 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
OLD | NEW |