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

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

Issue 238073002: Provide UI for per-extension enabling/disabling of error collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 f2d19eba5434fd1949ab473d66c9b3b846b46eb0..dacea8559b37917b12ceaab16130ae7566cc0752 100644
--- a/chrome/browser/extensions/error_console/error_console.h
+++ b/chrome/browser/extensions/error_console/error_console.h
@@ -30,8 +30,8 @@ class ExtensionService;
class Profile;
namespace extensions {
-class ErrorConsoleUnitTest;
class Extension;
+class ExtensionPrefs;
// The ErrorConsole is a central object to which all extension errors are
// reported. This includes errors detected in extensions core, as well as
@@ -65,6 +65,15 @@ class ErrorConsole : public content::NotificationObserver,
ExtensionError::Type type,
bool enabled);
+ // Set whether or not errors of all types are stored for the extension with
+ // the given |extension_id|.
+ void SetReportingAllForExtension(const std::string& extension_id,
+ bool enabled);
+
+ // Returns true if reporting for either manifest or runtime errors is enabled
+ // for the extension with the given |extension_id|.
+ bool IsReportingEnabledForExtension(const std::string& extension_id) const;
+
// Restore default reporting to the given extension.
void UseDefaultReportingForExtension(const std::string& extension_id);
@@ -102,10 +111,6 @@ class ErrorConsole : public content::NotificationObserver,
}
private:
- // A map which stores the reporting preferences for each Extension. If there
- // is no entry in the map, it signals that the |default_mask_| should be used.
- typedef std::map<std::string, int32> ErrorPreferenceMap;
-
// Checks whether or not the ErrorConsole should be enabled or disabled. If it
// is in the wrong state, enables or disables it appropriately.
void CheckEnabled();
@@ -138,6 +143,11 @@ class ErrorConsole : public content::NotificationObserver,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Returns true if we should report the error of the given type for the
+ // extension.
+ bool ShouldReportErrorForExtension(const std::string& extension_id,
+ ExtensionError::Type type) const;
+
// Whether or not the error console should record errors. This is true if
// the user is in developer mode, and at least one of the following is true:
// - The Chrome Apps Developer Tools are installed.
@@ -154,9 +164,6 @@ class ErrorConsole : public content::NotificationObserver,
// The errors which we have received so far.
ErrorMap errors_;
- // The mapping of Extension's error-reporting preferences.
- ErrorPreferenceMap pref_map_;
-
// The default mask to use if an Extension does not have specific settings.
int32 default_mask_;
@@ -165,6 +172,11 @@ class ErrorConsole : public content::NotificationObserver,
// incognito fellow).
Profile* profile_;
+ // The ExtensionPrefs with which the ErrorConsole is associated. This weak
+ // pointer is safe because ErrorConsole is owned by ExtensionSystem, which
+ // is dependent on ExtensionPrefs.
+ ExtensionPrefs* prefs_;
+
content::NotificationRegistrar notification_registrar_;
PrefChangeRegistrar pref_registrar_;

Powered by Google App Engine
This is Rietveld 408576698