OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" |
12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 #include "extensions/browser/error_map.h" | 16 #include "extensions/browser/error_map.h" |
16 #include "extensions/browser/extension_error.h" | 17 #include "extensions/browser/extension_error.h" |
17 #include "extensions/browser/extension_registry_observer.h" | 18 #include "extensions/browser/extension_registry_observer.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class BrowserContext; | 21 class BrowserContext; |
21 class NotificationDetails; | 22 class NotificationDetails; |
22 class NotificationSource; | 23 class NotificationSource; |
23 class RenderViewHost; | 24 class RenderViewHost; |
24 } | 25 } |
25 | 26 |
26 class Profile; | 27 class Profile; |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
29 class Extension; | 30 class Extension; |
30 class ExtensionPrefs; | 31 class ExtensionPrefs; |
31 class ExtensionRegistry; | 32 class ExtensionRegistry; |
32 | 33 |
33 // The ErrorConsole is a central object to which all extension errors are | 34 // The ErrorConsole is a central object to which all extension errors are |
34 // reported. This includes errors detected in extensions core, as well as | 35 // reported. This includes errors detected in extensions core, as well as |
35 // runtime Javascript errors. If FeatureSwitch::error_console() is enabled these | 36 // runtime Javascript errors. If FeatureSwitch::error_console() is enabled these |
36 // errors can be viewed at chrome://extensions in developer mode. | 37 // errors can be viewed at chrome://extensions in developer mode. |
37 // This class is owned by ExtensionSystem, making it, in effect, a | 38 // This class is owned by ExtensionSystem, making it, in effect, a |
38 // BrowserContext-keyed service. | 39 // BrowserContext-keyed service. |
39 class ErrorConsole : public content::NotificationObserver, | 40 class ErrorConsole : public KeyedService, |
| 41 public content::NotificationObserver, |
40 public ExtensionRegistryObserver { | 42 public ExtensionRegistryObserver { |
41 public: | 43 public: |
42 class Observer { | 44 class Observer { |
43 public: | 45 public: |
44 // Sent when a new error is reported to the error console. | 46 // Sent when a new error is reported to the error console. |
45 virtual void OnErrorAdded(const ExtensionError* error); | 47 virtual void OnErrorAdded(const ExtensionError* error); |
46 | 48 |
47 // Sent when errors are removed from the error console. |extension_ids| is | 49 // Sent when errors are removed from the error console. |extension_ids| is |
48 // the set of ids that were affected. | 50 // the set of ids that were affected. |
49 // Note: This is not sent when an extension is uninstalled, or when a | 51 // Note: This is not sent when an extension is uninstalled, or when a |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 195 |
194 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 196 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
195 registry_observer_; | 197 registry_observer_; |
196 | 198 |
197 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); | 199 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); |
198 }; | 200 }; |
199 | 201 |
200 } // namespace extensions | 202 } // namespace extensions |
201 | 203 |
202 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 204 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
OLD | NEW |