Chromium Code Reviews| 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 <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 // Convenience method to return the ErrorConsole for a given profile. | 58 // Convenience method to return the ErrorConsole for a given profile. |
| 59 static ErrorConsole* Get(Profile* profile); | 59 static ErrorConsole* Get(Profile* profile); |
| 60 | 60 |
| 61 // Set whether or not errors of the specified |type| are stored for the | 61 // Set whether or not errors of the specified |type| are stored for the |
| 62 // extension with the given |extension_id|. This will be stored in the | 62 // extension with the given |extension_id|. This will be stored in the |
| 63 // preferences. | 63 // preferences. |
| 64 void SetReportingForExtension(const std::string& extension_id, | 64 void SetReportingForExtension(const std::string& extension_id, |
| 65 ExtensionError::Type type, | 65 ExtensionError::Type type, |
| 66 bool enabled); | 66 bool enabled); |
| 67 | 67 |
| 68 // Set whether or not errors of all types are stored for the extension with | |
| 69 // the given |extension_id|. | |
| 70 void SetReportingForExtensionForAllTypes(const std::string& extension_id, | |
|
not at google - send to devlin
2014/04/16 21:28:31
SetReportingAllForExtension?
Devlin
2014/04/16 22:50:41
Sure, why not.
| |
| 71 bool enabled); | |
| 72 | |
| 73 // Returns true if reporting for either manifest or runtime errors is enabled | |
| 74 // for the extension with the given |extension_id|. | |
| 75 bool IsReportingEnabledForExtension(const std::string& extension_id) const; | |
| 76 | |
| 68 // Restore default reporting to the given extension. | 77 // Restore default reporting to the given extension. |
| 69 void UseDefaultReportingForExtension(const std::string& extension_id); | 78 void UseDefaultReportingForExtension(const std::string& extension_id); |
| 70 | 79 |
| 71 // Report an extension error, and add it to the list. | 80 // Report an extension error, and add it to the list. |
| 72 void ReportError(scoped_ptr<ExtensionError> error); | 81 void ReportError(scoped_ptr<ExtensionError> error); |
| 73 | 82 |
| 74 // Get a collection of weak pointers to all errors relating to the extension | 83 // Get a collection of weak pointers to all errors relating to the extension |
| 75 // with the given |extension_id|. | 84 // with the given |extension_id|. |
| 76 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; | 85 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; |
| 77 | 86 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 const Extension* extension) OVERRIDE; | 140 const Extension* extension) OVERRIDE; |
| 132 | 141 |
| 133 // Add manifest errors from an extension's install warnings. | 142 // Add manifest errors from an extension's install warnings. |
| 134 void AddManifestErrorsForExtension(const Extension* extension); | 143 void AddManifestErrorsForExtension(const Extension* extension); |
| 135 | 144 |
| 136 // content::NotificationObserver implementation. | 145 // content::NotificationObserver implementation. |
| 137 virtual void Observe(int type, | 146 virtual void Observe(int type, |
| 138 const content::NotificationSource& source, | 147 const content::NotificationSource& source, |
| 139 const content::NotificationDetails& details) OVERRIDE; | 148 const content::NotificationDetails& details) OVERRIDE; |
| 140 | 149 |
| 150 // Sets the extension preference for error reporting. | |
| 151 void SetExtensionPref(const std::string& extension_id, int32 mask); | |
| 152 | |
| 153 // Returns true if we should report the error of the given type for the | |
| 154 // extension. | |
| 155 bool ShouldReportErrorForExtension(const std::string& extension_id, | |
| 156 ExtensionError::Type type) const; | |
| 157 | |
| 141 // Whether or not the error console should record errors. This is true if | 158 // Whether or not the error console should record errors. This is true if |
| 142 // the user is in developer mode, and at least one of the following is true: | 159 // the user is in developer mode, and at least one of the following is true: |
| 143 // - The Chrome Apps Developer Tools are installed. | 160 // - The Chrome Apps Developer Tools are installed. |
| 144 // - FeatureSwitch::error_console() is enabled. | 161 // - FeatureSwitch::error_console() is enabled. |
| 145 // - This is a Dev Channel release. | 162 // - This is a Dev Channel release. |
| 146 bool enabled_; | 163 bool enabled_; |
| 147 | 164 |
| 148 // Needed because ObserverList is not thread-safe. | 165 // Needed because ObserverList is not thread-safe. |
| 149 base::ThreadChecker thread_checker_; | 166 base::ThreadChecker thread_checker_; |
| 150 | 167 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 170 | 187 |
| 171 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 188 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 172 registry_observer_; | 189 registry_observer_; |
| 173 | 190 |
| 174 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); | 191 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); |
| 175 }; | 192 }; |
| 176 | 193 |
| 177 } // namespace extensions | 194 } // namespace extensions |
| 178 | 195 |
| 179 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 196 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
| OLD | NEW |