| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // runtime Javascript errors. If FeatureSwitch::error_console() is enabled these | 35 // runtime Javascript errors. If FeatureSwitch::error_console() is enabled these |
| 36 // errors can be viewed at chrome://extensions in developer mode. | 36 // errors can be viewed at chrome://extensions in developer mode. |
| 37 // This class is owned by ExtensionSystem, making it, in effect, a | 37 // This class is owned by ExtensionSystem, making it, in effect, a |
| 38 // BrowserContext-keyed service. | 38 // BrowserContext-keyed service. |
| 39 class ErrorConsole : public content::NotificationObserver, | 39 class ErrorConsole : public content::NotificationObserver, |
| 40 public ExtensionRegistryObserver { | 40 public ExtensionRegistryObserver { |
| 41 public: | 41 public: |
| 42 class Observer { | 42 class Observer { |
| 43 public: | 43 public: |
| 44 // Sent when a new error is reported to the error console. | 44 // Sent when a new error is reported to the error console. |
| 45 virtual void OnErrorAdded(const ExtensionError* error) = 0; | 45 virtual void OnErrorAdded(const ExtensionError* error); |
| 46 |
| 47 // Sent when errors are removed from the error console. |extension_ids| is |
| 48 // the set of ids that were affected. |
| 49 // Note: This is not sent when an extension is uninstalled, or when a |
| 50 // profile is destroyed. |
| 51 virtual void OnErrorsRemoved(const std::set<std::string>& extension_ids); |
| 46 | 52 |
| 47 // Sent upon destruction to allow any observers to invalidate any references | 53 // Sent upon destruction to allow any observers to invalidate any references |
| 48 // they have to the error console. | 54 // they have to the error console. |
| 49 virtual void OnErrorConsoleDestroyed(); | 55 virtual void OnErrorConsoleDestroyed(); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 explicit ErrorConsole(Profile* profile); | 58 explicit ErrorConsole(Profile* profile); |
| 53 ~ErrorConsole() override; | 59 ~ErrorConsole() override; |
| 54 | 60 |
| 55 // Convenience method to return the ErrorConsole for a given |context|. | 61 // Convenience method to return the ErrorConsole for a given |context|. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 193 |
| 188 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 194 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 189 registry_observer_; | 195 registry_observer_; |
| 190 | 196 |
| 191 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); | 197 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); |
| 192 }; | 198 }; |
| 193 | 199 |
| 194 } // namespace extensions | 200 } // namespace extensions |
| 195 | 201 |
| 196 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 202 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
| OLD | NEW |