Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1394)

Unified Diff: chrome/browser/extensions/error_console/error_console.h

Issue 23311011: ErrorConsole Switch, Duplicate Error Detection, Dev Mode Check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c48efc2192b667522709e70ead1d3ea2c6efc170 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"
@@ -71,6 +72,17 @@ class ErrorConsole : public content::NotificationObserver {
private:
FRIEND_TEST_ALL_PREFIXES(ErrorConsoleUnitTest, AddAndRemoveErrors);
+ // Enable the error console for error collection and retention.
+ void Enable();
+ // 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();
+
// Remove all errors which happened while incognito; we have to do this once
// the incognito profile is destroyed.
void RemoveIncognitoErrors();
@@ -86,6 +98,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 +116,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);
};

Powered by Google App Engine
This is Rietveld 408576698