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" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "chrome/browser/infobars/infobar_delegate.h" | 12 #include "chrome/browser/infobars/infobar_delegate.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 class InfoBar; | 18 class InfoBar; |
19 | 19 |
20 // Provides access to creating, removing and enumerating info bars | 20 // Provides access to creating, removing and enumerating info bars |
21 // attached to a tab. | 21 // attached to a tab. |
22 class InfoBarManager { | 22 class InfoBarManager { |
23 public: | 23 public: |
24 // Observer class for infobar events. | 24 // Observer class for infobar events. |
25 class Observer { | 25 class Observer { |
26 public: | 26 public: |
27 virtual void OnInfoBarAdded(InfoBar* infobar) = 0; | 27 virtual ~Observer() {} |
Ilya Sherman
2014/04/19 19:46:04
nit: I don't think you need to explicitly define t
tfarina
2014/04/19 22:03:23
Done.
| |
28 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) = 0; | 28 |
29 virtual void OnInfoBarAdded(InfoBar* infobar) {} | |
30 virtual void OnInfoBarRemoved(InfoBar* infobar, bool animate) {} | |
29 virtual void OnInfoBarReplaced(InfoBar* old_infobar, | 31 virtual void OnInfoBarReplaced(InfoBar* old_infobar, |
30 InfoBar* new_infobar) = 0; | 32 InfoBar* new_infobar) {} |
31 virtual void OnManagerShuttingDown(InfoBarManager* manager) = 0; | 33 virtual void OnManagerShuttingDown(InfoBarManager* manager) {} |
32 }; | 34 }; |
33 | 35 |
34 InfoBarManager(); | 36 InfoBarManager(); |
35 virtual ~InfoBarManager(); | 37 virtual ~InfoBarManager(); |
36 | 38 |
37 // Must be called before destruction. | 39 // Must be called before destruction. |
38 // 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 |
39 // for notifications are removed (see http://crbug.com/354380). | 41 // for notifications are removed (see http://crbug.com/354380). |
40 void ShutDown(); | 42 void ShutDown(); |
41 | 43 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 | 113 |
112 InfoBars infobars_; | 114 InfoBars infobars_; |
113 bool infobars_enabled_; | 115 bool infobars_enabled_; |
114 | 116 |
115 ObserverList<Observer, true> observer_list_; | 117 ObserverList<Observer, true> observer_list_; |
116 | 118 |
117 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 119 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
118 }; | 120 }; |
119 | 121 |
120 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ | 122 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_MANAGER_H_ |
OLD | NEW |