Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "chrome/browser/extensions/extension_toolbar_model.h" | 29 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 30 #include "chrome/browser/extensions/extensions_quota_service.h" | 30 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 31 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 31 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
| 32 #include "chrome/browser/extensions/pending_extension_manager.h" | 32 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 33 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 33 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| 34 #include "chrome/browser/prefs/pref_change_registrar.h" | 34 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
| 36 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
| 37 #include "content/common/notification_observer.h" | 37 #include "content/common/notification_observer.h" |
| 38 #include "content/common/notification_registrar.h" | 38 #include "content/common/notification_registrar.h" |
| 39 #include "content/common/notification_source.h" | |
| 39 #include "content/common/property_bag.h" | 40 #include "content/common/property_bag.h" |
| 40 | 41 |
| 41 class CrxInstaller; | 42 class CrxInstaller; |
| 42 class ExtensionBrowserEventRouter; | 43 class ExtensionBrowserEventRouter; |
| 43 class ExtensionContentSettingsStore; | 44 class ExtensionContentSettingsStore; |
| 44 class ExtensionInstallUI; | 45 class ExtensionInstallUI; |
| 45 class ExtensionPreferenceEventRouter; | 46 class ExtensionPreferenceEventRouter; |
| 46 class ExtensionServiceBackend; | 47 class ExtensionServiceBackend; |
| 47 struct ExtensionSyncData; | 48 struct ExtensionSyncData; |
| 48 class ExtensionToolbarModel; | 49 class ExtensionToolbarModel; |
| 49 class ExtensionUpdater; | 50 class ExtensionUpdater; |
| 50 class GURL; | 51 class GURL; |
| 51 class PendingExtensionManager; | 52 class PendingExtensionManager; |
| 52 class Profile; | 53 class Profile; |
| 53 class Version; | 54 class Version; |
| 54 | 55 |
| 55 // This is an interface class to encapsulate the dependencies that | 56 // This is an interface class to encapsulate the dependencies that |
| 56 // various classes have on ExtensionService. This allows easy mocking. | 57 // various classes have on ExtensionService. This allows easy mocking. |
| 57 class ExtensionServiceInterface { | 58 class ExtensionServiceInterface { |
| 58 public: | 59 public: |
| 59 // A function that returns true if the given extension should be | 60 // A function that returns true if the given extension should be |
| 60 // included and false if it should be filtered out. Identical to | 61 // included and false if it should be filtered out. Identical to |
| 61 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 62 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
| 62 typedef bool (*ExtensionFilter)(const Extension&); | 63 typedef bool (*ExtensionFilter)(const Extension&); |
| 63 | 64 |
| 64 virtual ~ExtensionServiceInterface() {} | 65 virtual ~ExtensionServiceInterface() {} |
| 65 virtual const ExtensionList* extensions() const = 0; | 66 virtual const ExtensionList* extensions() const = 0; |
| 66 virtual PendingExtensionManager* pending_extension_manager() = 0; | 67 virtual PendingExtensionManager* pending_extension_manager() = 0; |
| 67 virtual void UpdateExtension(const std::string& id, | 68 virtual bool UpdateExtension( |
| 68 const FilePath& path, | 69 const std::string& id, |
| 69 const GURL& download_url) = 0; | 70 const FilePath& path, |
| 71 const GURL& download_url, | |
| 72 Source<CrxInstaller>* out_install_notification_source) = 0; | |
|
Matt Perry
2011/05/31 21:34:25
Why a Source? Let's just pass a raw pointer out.
Sam Kerner (Chrome)
2011/05/31 23:16:15
Done.
| |
| 70 virtual const Extension* GetExtensionById(const std::string& id, | 73 virtual const Extension* GetExtensionById(const std::string& id, |
| 71 bool include_disabled) const = 0; | 74 bool include_disabled) const = 0; |
| 72 virtual const Extension* GetInstalledExtension( | 75 virtual const Extension* GetInstalledExtension( |
| 73 const std::string& id) const = 0; | 76 const std::string& id) const = 0; |
| 74 | 77 |
| 75 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; | 78 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; |
| 76 virtual bool IsExternalExtensionUninstalled( | 79 virtual bool IsExternalExtensionUninstalled( |
| 77 const std::string& extension_id) const = 0; | 80 const std::string& extension_id) const = 0; |
| 78 | 81 |
| 79 virtual void UpdateExtensionBlacklist( | 82 virtual void UpdateExtensionBlacklist( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 | 258 |
| 256 // Looks up an extension by ID, regardless of whether it's enabled, | 259 // Looks up an extension by ID, regardless of whether it's enabled, |
| 257 // disabled, or terminated. | 260 // disabled, or terminated. |
| 258 virtual const Extension* GetInstalledExtension( | 261 virtual const Extension* GetInstalledExtension( |
| 259 const std::string& id) const OVERRIDE; | 262 const std::string& id) const OVERRIDE; |
| 260 | 263 |
| 261 // Updates a currently-installed extension with the contents from | 264 // Updates a currently-installed extension with the contents from |
| 262 // |extension_path|. | 265 // |extension_path|. |
| 263 // TODO(aa): This method can be removed. ExtensionUpdater could use | 266 // TODO(aa): This method can be removed. ExtensionUpdater could use |
| 264 // CrxInstaller directly instead. | 267 // CrxInstaller directly instead. |
| 265 virtual void UpdateExtension(const std::string& id, | 268 virtual bool UpdateExtension( |
| 266 const FilePath& extension_path, | 269 const std::string& id, |
| 267 const GURL& download_url) OVERRIDE; | 270 const FilePath& extension_path, |
| 271 const GURL& download_url, | |
| 272 Source<CrxInstaller>* out_install_notification_source) OVERRIDE; | |
| 268 | 273 |
| 269 // Reloads the specified extension. | 274 // Reloads the specified extension. |
| 270 void ReloadExtension(const std::string& extension_id); | 275 void ReloadExtension(const std::string& extension_id); |
| 271 | 276 |
| 272 // Uninstalls the specified extension. Callers should only call this method | 277 // Uninstalls the specified extension. Callers should only call this method |
| 273 // with extensions that exist. |external_uninstall| is a magical parameter | 278 // with extensions that exist. |external_uninstall| is a magical parameter |
| 274 // that is only used to send information to ExtensionPrefs, which external | 279 // that is only used to send information to ExtensionPrefs, which external |
| 275 // callers should never set to true. | 280 // callers should never set to true. |
| 276 // TODO(aa): Remove |external_uninstall| -- this information should be passed | 281 // TODO(aa): Remove |external_uninstall| -- this information should be passed |
| 277 // to ExtensionPrefs some other way. | 282 // to ExtensionPrefs some other way. |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 NaClModuleInfoList nacl_module_list_; | 701 NaClModuleInfoList nacl_module_list_; |
| 697 | 702 |
| 698 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 703 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 699 InstallAppsWithUnlimtedStorage); | 704 InstallAppsWithUnlimtedStorage); |
| 700 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 705 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 701 InstallAppsAndCheckStorageProtection); | 706 InstallAppsAndCheckStorageProtection); |
| 702 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 707 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 703 }; | 708 }; |
| 704 | 709 |
| 705 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 710 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |