| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. | 44 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. |
| 45 class ExtensionUpdateService { | 45 class ExtensionUpdateService { |
| 46 public: | 46 public: |
| 47 virtual ~ExtensionUpdateService() {} | 47 virtual ~ExtensionUpdateService() {} |
| 48 virtual const ExtensionList* extensions() const = 0; | 48 virtual const ExtensionList* extensions() const = 0; |
| 49 virtual void UpdateExtension(const std::string& id, const FilePath& path) = 0; | 49 virtual void UpdateExtension(const std::string& id, const FilePath& path) = 0; |
| 50 virtual Extension* GetExtensionById(const std::string& id, | 50 virtual Extension* GetExtensionById(const std::string& id, |
| 51 bool include_disabled) = 0; | 51 bool include_disabled) = 0; |
| 52 virtual void UpdateExtensionBlacklist( | 52 virtual void UpdateExtensionBlacklist( |
| 53 const std::vector<std::string>& blacklist) = 0; | 53 const std::vector<std::string>& blacklist) = 0; |
| 54 virtual bool HasInstalledExtensions() = 0; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Manages installed and running Chromium extensions. | 57 // Manages installed and running Chromium extensions. |
| 57 class ExtensionsService | 58 class ExtensionsService |
| 58 : public base::RefCountedThreadSafe<ExtensionsService, | 59 : public base::RefCountedThreadSafe<ExtensionsService, |
| 59 ChromeThread::DeleteOnUIThread>, | 60 ChromeThread::DeleteOnUIThread>, |
| 60 public BlacklistPathProvider, | 61 public BlacklistPathProvider, |
| 61 public ExtensionUpdateService, | 62 public ExtensionUpdateService, |
| 62 public NotificationObserver { | 63 public NotificationObserver { |
| 63 public: | 64 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 81 PrefService* prefs, | 82 PrefService* prefs, |
| 82 const FilePath& install_directory, | 83 const FilePath& install_directory, |
| 83 bool autoupdate_enabled); | 84 bool autoupdate_enabled); |
| 84 | 85 |
| 85 // Gets the list of currently installed extensions. | 86 // Gets the list of currently installed extensions. |
| 86 virtual const ExtensionList* extensions() const { return &extensions_; } | 87 virtual const ExtensionList* extensions() const { return &extensions_; } |
| 87 virtual const ExtensionList* disabled_extensions() const { | 88 virtual const ExtensionList* disabled_extensions() const { |
| 88 return &disabled_extensions_; | 89 return &disabled_extensions_; |
| 89 } | 90 } |
| 90 | 91 |
| 92 // Returns true if any extensions are installed. |
| 93 virtual bool HasInstalledExtensions() { |
| 94 return !(extensions_.empty() && disabled_extensions_.empty()); |
| 95 } |
| 96 |
| 91 const FilePath& install_directory() const { return install_directory_; } | 97 const FilePath& install_directory() const { return install_directory_; } |
| 92 | 98 |
| 93 // Initialize and start all installed extensions. | 99 // Initialize and start all installed extensions. |
| 94 void Init(); | 100 void Init(); |
| 95 | 101 |
| 96 // Look up an extension by ID. | 102 // Look up an extension by ID. |
| 97 Extension* GetExtensionById(const std::string& id, bool include_disabled) { | 103 Extension* GetExtensionById(const std::string& id, bool include_disabled) { |
| 98 return GetExtensionByIdInternal(id, true, include_disabled); | 104 return GetExtensionByIdInternal(id, true, include_disabled); |
| 99 } | 105 } |
| 100 | 106 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 392 |
| 387 // A map of all external extension providers. | 393 // A map of all external extension providers. |
| 388 typedef std::map<Extension::Location, | 394 typedef std::map<Extension::Location, |
| 389 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 395 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 390 ProviderMap external_extension_providers_; | 396 ProviderMap external_extension_providers_; |
| 391 | 397 |
| 392 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 398 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 393 }; | 399 }; |
| 394 | 400 |
| 395 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 401 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |