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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 | 71 |
72 // Get a collection of weak pointers to all errors relating to the extension | 72 // Get a collection of weak pointers to all errors relating to the extension |
73 // with the given |extension_id|. | 73 // with the given |extension_id|. |
74 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; | 74 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; |
75 | 75 |
76 // Add or remove observers of the ErrorConsole to be notified of any errors | 76 // Add or remove observers of the ErrorConsole to be notified of any errors |
77 // added. | 77 // added. |
78 void AddObserver(Observer* observer); | 78 void AddObserver(Observer* observer); |
79 void RemoveObserver(Observer* observer); | 79 void RemoveObserver(Observer* observer); |
80 | 80 |
81 bool enabled() const { return enabled_; } | 81 // Returns whether or not the ErrorConsole is enabled for the |
82 // chrome:extensions page or the Chrome Apps Developer Tools. | |
83 // TODO(rdevlin.cronin): These have different answers - ErrorConsole is | |
84 // enabled by default in ADT, but only Dev Channel for chrome:extensoins (or | |
not at google - send to devlin
2014/03/28 22:05:32
chrome://extensions
you misspelled extensions.
Devlin
2014/03/31 18:39:31
Done.
| |
85 // with the commandline switch). Once we do a full launch, clean all this up. | |
86 bool IsEnabledForChromeExtensionsPage() const; | |
87 bool IsEnabledForAppsDeveloperTools() const; | |
82 | 88 |
83 // Return the number of entries (extensions) in the error map. | 89 // Return the number of entries (extensions) in the error map. |
84 size_t get_num_entries_for_test() const { return errors_.size(); } | 90 size_t get_num_entries_for_test() const { return errors_.size(); } |
85 | 91 |
86 // Set the default reporting for all extensions. | 92 // Set the default reporting for all extensions. |
87 void set_default_reporting_for_test(ExtensionError::Type type, bool enabled) { | 93 void set_default_reporting_for_test(ExtensionError::Type type, bool enabled) { |
88 default_mask_ = | 94 default_mask_ = |
89 enabled ? default_mask_ | (1 << type) : default_mask_ & ~(1 << type); | 95 enabled ? default_mask_ | (1 << type) : default_mask_ & ~(1 << type); |
90 } | 96 } |
91 | 97 |
(...skipping 16 matching lines...) Expand all Loading... | |
108 void OnPrefChanged(); | 114 void OnPrefChanged(); |
109 | 115 |
110 // Add manifest errors from an extension's install warnings. | 116 // Add manifest errors from an extension's install warnings. |
111 void AddManifestErrorsForExtension(const Extension* extension); | 117 void AddManifestErrorsForExtension(const Extension* extension); |
112 | 118 |
113 // content::NotificationObserver implementation. | 119 // content::NotificationObserver implementation. |
114 virtual void Observe(int type, | 120 virtual void Observe(int type, |
115 const content::NotificationSource& source, | 121 const content::NotificationSource& source, |
116 const content::NotificationDetails& details) OVERRIDE; | 122 const content::NotificationDetails& details) OVERRIDE; |
117 | 123 |
118 // Whether or not the error console is enabled; it is enabled if the | 124 // Whether or not the error console should record errors. This is true if |
119 // FeatureSwitch (FeatureSwitch::error_console) is enabled and the user is | 125 // the user is in developer mode, and at least one of the following is true: |
120 // in Developer Mode. | 126 // - The Chrome Apps Developer Tools are installed. |
121 bool enabled_; | 127 // - FeatureSwitch::error_console() is enabled. |
128 // - This is a Dev Channel release. | |
129 bool should_record_; | |
122 | 130 |
123 // Needed because ObserverList is not thread-safe. | 131 // Needed because ObserverList is not thread-safe. |
124 base::ThreadChecker thread_checker_; | 132 base::ThreadChecker thread_checker_; |
125 | 133 |
126 // The list of all observers for the ErrorConsole. | 134 // The list of all observers for the ErrorConsole. |
127 ObserverList<Observer> observers_; | 135 ObserverList<Observer> observers_; |
128 | 136 |
129 // The errors which we have received so far. | 137 // The errors which we have received so far. |
130 ErrorMap errors_; | 138 ErrorMap errors_; |
131 | 139 |
(...skipping 10 matching lines...) Expand all Loading... | |
142 | 150 |
143 content::NotificationRegistrar notification_registrar_; | 151 content::NotificationRegistrar notification_registrar_; |
144 PrefChangeRegistrar pref_registrar_; | 152 PrefChangeRegistrar pref_registrar_; |
145 | 153 |
146 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); | 154 DISALLOW_COPY_AND_ASSIGN(ErrorConsole); |
147 }; | 155 }; |
148 | 156 |
149 } // namespace extensions | 157 } // namespace extensions |
150 | 158 |
151 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ | 159 #endif // CHROME_BROWSER_EXTENSIONS_ERROR_CONSOLE_ERROR_CONSOLE_H_ |
OLD | NEW |