Index: chrome/browser/extensions/error_console/error_console.h |
diff --git a/chrome/browser/extensions/error_console/error_console.h b/chrome/browser/extensions/error_console/error_console.h |
index c60bda94db502d894f274e7dc310265feee52073..ce93ab5b5cc40e4a38a1b34c36ab9adf7658305e 100644 |
--- a/chrome/browser/extensions/error_console/error_console.h |
+++ b/chrome/browser/extensions/error_console/error_console.h |
@@ -11,6 +11,7 @@ |
#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
+#include "base/prefs/pref_change_registrar.h" |
#include "base/strings/string16.h" |
#include "base/threading/thread_checker.h" |
#include "content/public/browser/notification_observer.h" |
@@ -23,10 +24,12 @@ class NotificationSource; |
class RenderViewHost; |
} |
+class ExtensionService; |
class Profile; |
namespace extensions { |
class ErrorConsoleUnitTest; |
+class Extension; |
// The ErrorConsole is a central object to which all extension errors are |
// reported. This includes errors detected in extensions core, as well as |
@@ -48,7 +51,7 @@ class ErrorConsole : public content::NotificationObserver { |
virtual void OnErrorConsoleDestroyed(); |
}; |
- explicit ErrorConsole(Profile* profile); |
+ explicit ErrorConsole(Profile* profile, ExtensionService* extension_service); |
virtual ~ErrorConsole(); |
// Convenience method to return the ErrorConsole for a given profile. |
@@ -71,6 +74,21 @@ class ErrorConsole : public content::NotificationObserver { |
private: |
FRIEND_TEST_ALL_PREFIXES(ErrorConsoleUnitTest, AddAndRemoveErrors); |
+ // Enable the error console for error collection and retention. This involves |
+ // subscribing to the appropriate notifications and fetching manifest errors. |
+ void Enable(ExtensionService* extension_service); |
+ // Disable the error console, removing the subscriptions to notifications and |
+ // removing all current errors. |
+ void Disable(); |
+ |
+ // Called when the Developer Mode preference is changed; this is important |
+ // since we use this as a heuristic to determine if the console is enabled or |
+ // not. |
+ void OnPrefChanged(); |
+ |
+ // Add manifest errors from an extension's install warnings. |
+ void AddManifestErrorsForExtension(const Extension* extension); |
+ |
// Remove all errors which happened while incognito; we have to do this once |
// the incognito profile is destroyed. |
void RemoveIncognitoErrors(); |
@@ -86,6 +104,10 @@ class ErrorConsole : public content::NotificationObserver { |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
+ // Whether or not the error console is enabled. Currently, this is set by |
+ // whether or not the user has Developer Mode enabled. |
+ bool enabled_; |
+ |
// Needed because ObserverList is not thread-safe. |
base::ThreadChecker thread_checker_; |
@@ -100,7 +122,8 @@ class ErrorConsole : public content::NotificationObserver { |
// incognito fellow). |
Profile* profile_; |
- content::NotificationRegistrar registrar_; |
+ content::NotificationRegistrar notification_registrar_; |
+ PrefChangeRegistrar pref_registrar_; |
DISALLOW_COPY_AND_ASSIGN(ErrorConsole); |
}; |