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

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: Disable ErrorConsole for Android 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
« no previous file with comments | « no previous file | chrome/browser/extensions/error_console/error_console.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c8ebb54564360bcd7038e66cdaa1a093b504333 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"
@@ -55,7 +56,7 @@ class ErrorConsole : public content::NotificationObserver {
static ErrorConsole* Get(Profile* profile);
// Report an extension error, and add it to the list.
- void ReportError(scoped_ptr<const ExtensionError> error);
+ void ReportError(scoped_ptr<ExtensionError> error);
// Get a collection of weak pointers to all errors relating to the extension
// with the given |extension_id|.
@@ -66,11 +67,22 @@ class ErrorConsole : public content::NotificationObserver {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
- const ErrorMap& errors() { return errors_; }
+ const ErrorMap& errors() const { return errors_; }
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,11 @@ class ErrorConsole : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Whether or not the error console is enabled; it is enabled if the
+ // FeatureSwitch (FeatureSwitch::error_console) is enabled and the user is
+ // in Developer Mode.
+ bool enabled_;
+
// Needed because ObserverList is not thread-safe.
base::ThreadChecker thread_checker_;
@@ -100,7 +117,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);
};
« no previous file with comments | « no previous file | chrome/browser/extensions/error_console/error_console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698