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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/linked_ptr.h" | 15 #include "base/linked_ptr.h" |
16 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 #include "base/tuple.h" | 18 #include "base/tuple.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/chrome_thread.h" | 20 #include "chrome/browser/chrome_thread.h" |
21 #include "chrome/browser/extensions/extension_prefs.h" | 21 #include "chrome/browser/extensions/extension_prefs.h" |
22 #include "chrome/browser/extensions/extension_process_manager.h" | 22 #include "chrome/browser/extensions/extension_process_manager.h" |
| 23 #include "chrome/browser/extensions/extension_toolbar_model.h" |
23 #include "chrome/browser/extensions/extensions_quota_service.h" | 24 #include "chrome/browser/extensions/extensions_quota_service.h" |
24 #include "chrome/browser/extensions/external_extension_provider.h" | 25 #include "chrome/browser/extensions/external_extension_provider.h" |
25 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 26 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
26 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" | 27 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" |
27 #include "chrome/common/notification_observer.h" | 28 #include "chrome/common/notification_observer.h" |
28 #include "chrome/common/notification_registrar.h" | 29 #include "chrome/common/notification_registrar.h" |
29 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
30 | 31 |
31 class Browser; | 32 class Browser; |
32 class DictionaryValue; | 33 class DictionaryValue; |
33 class Extension; | 34 class Extension; |
34 class ExtensionsServiceBackend; | 35 class ExtensionsServiceBackend; |
| 36 class ExtensionToolbarModel; |
35 class ExtensionUpdater; | 37 class ExtensionUpdater; |
36 class GURL; | 38 class GURL; |
37 class PrefService; | 39 class PrefService; |
38 class Profile; | 40 class Profile; |
39 class ResourceDispatcherHost; | 41 class ResourceDispatcherHost; |
40 class SiteInstance; | 42 class SiteInstance; |
41 | 43 |
42 // This is an interface class to encapsulate the dependencies that | 44 // This is an interface class to encapsulate the dependencies that |
43 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. | 45 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. |
44 class ExtensionUpdateService { | 46 class ExtensionUpdateService { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void ProfileDestroyed() { profile_ = NULL; } | 208 void ProfileDestroyed() { profile_ = NULL; } |
207 | 209 |
208 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 210 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } |
209 | 211 |
210 // Whether the extension service is ready. | 212 // Whether the extension service is ready. |
211 bool is_ready() { return ready_; } | 213 bool is_ready() { return ready_; } |
212 | 214 |
213 // Note that this may return NULL if autoupdate is not turned on. | 215 // Note that this may return NULL if autoupdate is not turned on. |
214 ExtensionUpdater* updater() { return updater_.get(); } | 216 ExtensionUpdater* updater() { return updater_.get(); } |
215 | 217 |
| 218 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
| 219 |
216 ExtensionsQuotaService* quota_service() { return "a_service_; } | 220 ExtensionsQuotaService* quota_service() { return "a_service_; } |
217 | 221 |
218 // Notify the frontend that there was an error loading an extension. | 222 // Notify the frontend that there was an error loading an extension. |
219 // This method is public because ExtensionsServiceBackend can post to here. | 223 // This method is public because ExtensionsServiceBackend can post to here. |
220 void ReportExtensionLoadError(const FilePath& extension_path, | 224 void ReportExtensionLoadError(const FilePath& extension_path, |
221 const std::string& error, | 225 const std::string& error, |
222 NotificationType type, | 226 NotificationType type, |
223 bool be_noisy); | 227 bool be_noisy); |
224 | 228 |
225 // BlacklistPathProvider: | 229 // BlacklistPathProvider: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 289 |
286 // Used by dispatchers to limit API quota for individual extensions. | 290 // Used by dispatchers to limit API quota for individual extensions. |
287 ExtensionsQuotaService quota_service_; | 291 ExtensionsQuotaService quota_service_; |
288 | 292 |
289 // Is the service ready to go? | 293 // Is the service ready to go? |
290 bool ready_; | 294 bool ready_; |
291 | 295 |
292 // Our extension updater, if updates are turned on. | 296 // Our extension updater, if updates are turned on. |
293 scoped_refptr<ExtensionUpdater> updater_; | 297 scoped_refptr<ExtensionUpdater> updater_; |
294 | 298 |
| 299 // The model that tracks extensions with BrowserAction buttons. |
| 300 ExtensionToolbarModel toolbar_model_; |
| 301 |
295 // Map of inspector cookies that are detached, waiting for an extension to be | 302 // Map of inspector cookies that are detached, waiting for an extension to be |
296 // reloaded. | 303 // reloaded. |
297 typedef std::map<std::string, int> OrphanedDevTools; | 304 typedef std::map<std::string, int> OrphanedDevTools; |
298 OrphanedDevTools orphaned_dev_tools_; | 305 OrphanedDevTools orphaned_dev_tools_; |
299 | 306 |
300 NotificationRegistrar registrar_; | 307 NotificationRegistrar registrar_; |
301 | 308 |
302 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 309 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
303 }; | 310 }; |
304 | 311 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 401 |
395 // A map of all external extension providers. | 402 // A map of all external extension providers. |
396 typedef std::map<Extension::Location, | 403 typedef std::map<Extension::Location, |
397 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 404 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
398 ProviderMap external_extension_providers_; | 405 ProviderMap external_extension_providers_; |
399 | 406 |
400 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 407 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
401 }; | 408 }; |
402 | 409 |
403 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 410 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
OLD | NEW |