OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void ClearProvidersForTesting(); | 125 void ClearProvidersForTesting(); |
126 | 126 |
127 // Sets an ExternalExtensionProvider for the service to use during testing. | 127 // Sets an ExternalExtensionProvider for the service to use during testing. |
128 // |location| specifies what type of provider should be added. | 128 // |location| specifies what type of provider should be added. |
129 void SetProviderForTesting(Extension::Location location, | 129 void SetProviderForTesting(Extension::Location location, |
130 ExternalExtensionProvider* test_provider); | 130 ExternalExtensionProvider* test_provider); |
131 | 131 |
132 // The name of the file that the current active version number is stored in. | 132 // The name of the file that the current active version number is stored in. |
133 static const char* kCurrentVersionFileName; | 133 static const char* kCurrentVersionFileName; |
134 | 134 |
135 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 135 void SetExtensionsEnabled(bool enabled); |
| 136 bool extensions_enabled() { return extensions_enabled_; } |
| 137 |
136 void set_show_extensions_prompts(bool enabled) { | 138 void set_show_extensions_prompts(bool enabled) { |
137 show_extensions_prompts_ = enabled; | 139 show_extensions_prompts_ = enabled; |
138 } | 140 } |
139 | 141 |
140 bool extensions_enabled() { return extensions_enabled_; } | |
141 bool show_extensions_prompts() { | 142 bool show_extensions_prompts() { |
142 return show_extensions_prompts_; | 143 return show_extensions_prompts_; |
143 } | 144 } |
144 | 145 |
145 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 146 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } |
146 | 147 |
147 // Whether the extension service is ready. | 148 // Whether the extension service is ready. |
148 bool is_ready() { return ready_; } | 149 bool is_ready() { return ready_; } |
149 | 150 |
150 private: | 151 private: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 class ExtensionsServiceBackend | 203 class ExtensionsServiceBackend |
203 : public base::RefCountedThreadSafe<ExtensionsServiceBackend>, | 204 : public base::RefCountedThreadSafe<ExtensionsServiceBackend>, |
204 public ExternalExtensionProvider::Visitor { | 205 public ExternalExtensionProvider::Visitor { |
205 public: | 206 public: |
206 // |rdh| can be NULL in the case of test environment. | 207 // |rdh| can be NULL in the case of test environment. |
207 // |extension_prefs| contains a dictionary value that points to the extension | 208 // |extension_prefs| contains a dictionary value that points to the extension |
208 // preferences. | 209 // preferences. |
209 ExtensionsServiceBackend(const FilePath& install_directory, | 210 ExtensionsServiceBackend(const FilePath& install_directory, |
210 ResourceDispatcherHost* rdh, | 211 ResourceDispatcherHost* rdh, |
211 MessageLoop* frontend_loop, | 212 MessageLoop* frontend_loop, |
212 DictionaryValue* extension_prefs); | 213 DictionaryValue* extension_prefs, |
| 214 bool extensions_enabled); |
213 | 215 |
214 virtual ~ExtensionsServiceBackend(); | 216 virtual ~ExtensionsServiceBackend(); |
215 | 217 |
| 218 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
| 219 |
216 // Loads the installed extensions. | 220 // Loads the installed extensions. |
217 // Errors are reported through ExtensionErrorReporter. On completion, | 221 // Errors are reported through ExtensionErrorReporter. On completion, |
218 // OnExtensionsLoaded() is called with any successfully loaded extensions. | 222 // OnExtensionsLoaded() is called with any successfully loaded extensions. |
219 void LoadInstalledExtensions(scoped_refptr<ExtensionsService> frontend, | 223 void LoadInstalledExtensions(scoped_refptr<ExtensionsService> frontend, |
220 InstalledExtensions* installed); | 224 InstalledExtensions* installed); |
221 | 225 |
222 // Scans the extension installation directory to look for partially installed | 226 // Scans the extension installation directory to look for partially installed |
223 // or extensions to uninstall. | 227 // or extensions to uninstall. |
224 void GarbageCollectExtensions(scoped_refptr<ExtensionsService> frontend); | 228 void GarbageCollectExtensions(scoped_refptr<ExtensionsService> frontend); |
225 | 229 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 396 |
393 // We only need a pointer to this to pass along to other interfaces. | 397 // We only need a pointer to this to pass along to other interfaces. |
394 ResourceDispatcherHost* resource_dispatcher_host_; | 398 ResourceDispatcherHost* resource_dispatcher_host_; |
395 | 399 |
396 // Whether errors result in noisy alerts. | 400 // Whether errors result in noisy alerts. |
397 bool alert_on_error_; | 401 bool alert_on_error_; |
398 | 402 |
399 // The message loop to use to call the frontend. | 403 // The message loop to use to call the frontend. |
400 MessageLoop* frontend_loop_; | 404 MessageLoop* frontend_loop_; |
401 | 405 |
| 406 // Whether non-theme extensions are enabled (themes and externally registered |
| 407 // extensions are always enabled). |
| 408 bool extensions_enabled_; |
| 409 |
402 // A map of all external extension providers. | 410 // A map of all external extension providers. |
403 typedef std::map<Extension::Location, | 411 typedef std::map<Extension::Location, |
404 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 412 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
405 ProviderMap external_extension_providers_; | 413 ProviderMap external_extension_providers_; |
406 | 414 |
407 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 415 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
408 }; | 416 }; |
409 | 417 |
410 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 418 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
OLD | NEW |