OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Manages a set of warnings caused by extensions. These warnings (e.g. | 30 // Manages a set of warnings caused by extensions. These warnings (e.g. |
31 // conflicting modifications of network requests by extensions, slow extensions, | 31 // conflicting modifications of network requests by extensions, slow extensions, |
32 // etc.) trigger a warning badge in the UI and and provide means to resolve | 32 // etc.) trigger a warning badge in the UI and and provide means to resolve |
33 // them. This class must be used on the UI thread only. | 33 // them. This class must be used on the UI thread only. |
34 class ExtensionWarningService : public content::NotificationObserver, | 34 class ExtensionWarningService : public content::NotificationObserver, |
35 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
36 public: | 36 public: |
37 class Observer { | 37 class Observer { |
38 public: | 38 public: |
39 virtual void ExtensionWarningsChanged() = 0; | 39 virtual void ExtensionWarningsChanged() = 0; |
| 40 |
| 41 protected: |
| 42 virtual ~Observer() { } |
40 }; | 43 }; |
41 | 44 |
42 // |profile| may be NULL for testing. In this case, be sure to not insert | 45 // |profile| may be NULL for testing. In this case, be sure to not insert |
43 // any warnings. | 46 // any warnings. |
44 explicit ExtensionWarningService(Profile* profile); | 47 explicit ExtensionWarningService(Profile* profile); |
45 virtual ~ExtensionWarningService(); | 48 virtual ~ExtensionWarningService(); |
46 | 49 |
47 // Clears all warnings of types contained in |types| and notifies observers | 50 // Clears all warnings of types contained in |types| and notifies observers |
48 // of the changed warnings. | 51 // of the changed warnings. |
49 void ClearWarnings(const std::set<ExtensionWarning::WarningType>& types); | 52 void ClearWarnings(const std::set<ExtensionWarning::WarningType>& types); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 content::NotificationRegistrar registrar_; | 86 content::NotificationRegistrar registrar_; |
84 | 87 |
85 Profile* profile_; | 88 Profile* profile_; |
86 | 89 |
87 ObserverList<Observer> observer_list_; | 90 ObserverList<Observer> observer_list_; |
88 }; | 91 }; |
89 | 92 |
90 } // namespace extensions | 93 } // namespace extensions |
91 | 94 |
92 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WARNING_SERVICE_H_ |
OLD | NEW |