| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class ExtensionServiceInterface { | 57 class ExtensionServiceInterface { |
| 58 public: | 58 public: |
| 59 // A function that returns true if the given extension should be | 59 // A function that returns true if the given extension should be |
| 60 // included and false if it should be filtered out. Identical to | 60 // included and false if it should be filtered out. Identical to |
| 61 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 61 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
| 62 typedef bool (*ExtensionFilter)(const Extension&); | 62 typedef bool (*ExtensionFilter)(const Extension&); |
| 63 | 63 |
| 64 virtual ~ExtensionServiceInterface() {} | 64 virtual ~ExtensionServiceInterface() {} |
| 65 virtual const ExtensionList* extensions() const = 0; | 65 virtual const ExtensionList* extensions() const = 0; |
| 66 virtual PendingExtensionManager* pending_extension_manager() = 0; | 66 virtual PendingExtensionManager* pending_extension_manager() = 0; |
| 67 virtual void UpdateExtension(const std::string& id, | 67 |
| 68 const FilePath& path, | 68 // Install an update. Return true if the install can be started. |
| 69 const GURL& download_url) = 0; | 69 // Set out_crx_installer to the installer if one was started. |
| 70 virtual bool UpdateExtension( |
| 71 const std::string& id, |
| 72 const FilePath& path, |
| 73 const GURL& download_url, |
| 74 CrxInstaller** out_crx_installer) = 0; |
| 70 virtual const Extension* GetExtensionById(const std::string& id, | 75 virtual const Extension* GetExtensionById(const std::string& id, |
| 71 bool include_disabled) const = 0; | 76 bool include_disabled) const = 0; |
| 72 virtual const Extension* GetInstalledExtension( | 77 virtual const Extension* GetInstalledExtension( |
| 73 const std::string& id) const = 0; | 78 const std::string& id) const = 0; |
| 74 | 79 |
| 75 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; | 80 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; |
| 76 virtual bool IsExternalExtensionUninstalled( | 81 virtual bool IsExternalExtensionUninstalled( |
| 77 const std::string& extension_id) const = 0; | 82 const std::string& extension_id) const = 0; |
| 78 | 83 |
| 79 virtual void UpdateExtensionBlacklist( | 84 virtual void UpdateExtensionBlacklist( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 260 |
| 256 // Looks up an extension by ID, regardless of whether it's enabled, | 261 // Looks up an extension by ID, regardless of whether it's enabled, |
| 257 // disabled, or terminated. | 262 // disabled, or terminated. |
| 258 virtual const Extension* GetInstalledExtension( | 263 virtual const Extension* GetInstalledExtension( |
| 259 const std::string& id) const OVERRIDE; | 264 const std::string& id) const OVERRIDE; |
| 260 | 265 |
| 261 // Updates a currently-installed extension with the contents from | 266 // Updates a currently-installed extension with the contents from |
| 262 // |extension_path|. | 267 // |extension_path|. |
| 263 // TODO(aa): This method can be removed. ExtensionUpdater could use | 268 // TODO(aa): This method can be removed. ExtensionUpdater could use |
| 264 // CrxInstaller directly instead. | 269 // CrxInstaller directly instead. |
| 265 virtual void UpdateExtension(const std::string& id, | 270 virtual bool UpdateExtension( |
| 266 const FilePath& extension_path, | 271 const std::string& id, |
| 267 const GURL& download_url) OVERRIDE; | 272 const FilePath& extension_path, |
| 273 const GURL& download_url, |
| 274 CrxInstaller** out_crx_installer) OVERRIDE; |
| 268 | 275 |
| 269 // Reloads the specified extension. | 276 // Reloads the specified extension. |
| 270 void ReloadExtension(const std::string& extension_id); | 277 void ReloadExtension(const std::string& extension_id); |
| 271 | 278 |
| 272 // Uninstalls the specified extension. Callers should only call this method | 279 // Uninstalls the specified extension. Callers should only call this method |
| 273 // with extensions that exist. |external_uninstall| is a magical parameter | 280 // with extensions that exist. |external_uninstall| is a magical parameter |
| 274 // that is only used to send information to ExtensionPrefs, which external | 281 // that is only used to send information to ExtensionPrefs, which external |
| 275 // callers should never set to true. | 282 // callers should never set to true. |
| 276 // TODO(aa): Remove |external_uninstall| -- this information should be passed | 283 // TODO(aa): Remove |external_uninstall| -- this information should be passed |
| 277 // to ExtensionPrefs some other way. | 284 // to ExtensionPrefs some other way. |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 NaClModuleInfoList nacl_module_list_; | 703 NaClModuleInfoList nacl_module_list_; |
| 697 | 704 |
| 698 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 705 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 699 InstallAppsWithUnlimtedStorage); | 706 InstallAppsWithUnlimtedStorage); |
| 700 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 707 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 701 InstallAppsAndCheckStorageProtection); | 708 InstallAppsAndCheckStorageProtection); |
| 702 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 709 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 703 }; | 710 }; |
| 704 | 711 |
| 705 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 712 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |