Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 } // namespace extensions | 60 } // namespace extensions |
| 61 | 61 |
| 62 // This is an interface class to encapsulate the dependencies that | 62 // This is an interface class to encapsulate the dependencies that |
| 63 // various classes have on ExtensionService. This allows easy mocking. | 63 // various classes have on ExtensionService. This allows easy mocking. |
| 64 class ExtensionServiceInterface | 64 class ExtensionServiceInterface |
| 65 : public base::SupportsWeakPtr<ExtensionServiceInterface> { | 65 : public base::SupportsWeakPtr<ExtensionServiceInterface> { |
| 66 public: | 66 public: |
| 67 virtual ~ExtensionServiceInterface() {} | 67 virtual ~ExtensionServiceInterface() {} |
| 68 | 68 |
| 69 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead. | 69 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead. |
| 70 // | |
| 70 // ExtensionRegistry also has the disabled, terminated and blacklisted sets. | 71 // ExtensionRegistry also has the disabled, terminated and blacklisted sets. |
| 71 virtual const extensions::ExtensionSet* extensions() const = 0; | 72 virtual const extensions::ExtensionSet* extensions() const = 0; |
| 72 | 73 |
| 73 // Gets the object managing the set of pending extensions. | 74 // Gets the object managing the set of pending extensions. |
| 74 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0; | 75 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0; |
| 75 | 76 |
| 76 // Installs an update with the contents from |extension_path|. Returns true if | 77 // Installs an update with the contents from |extension_path|. Returns true if |
| 77 // the install can be started. Sets |out_crx_installer| to the installer if | 78 // the install can be started. Sets |out_crx_installer| to the installer if |
| 78 // one was started. | 79 // one was started. |
| 79 // TODO(aa): This method can be removed. ExtensionUpdater could use | 80 // TODO(aa): This method can be removed. ExtensionUpdater could use |
| 80 // CrxInstaller directly instead. | 81 // CrxInstaller directly instead. |
| 81 virtual bool UpdateExtension( | 82 virtual bool UpdateExtension( |
| 82 const std::string& id, | 83 const std::string& id, |
| 83 const base::FilePath& path, | 84 const base::FilePath& path, |
| 84 bool file_ownership_passed, | 85 bool file_ownership_passed, |
| 85 extensions::CrxInstaller** out_crx_installer) = 0; | 86 extensions::CrxInstaller** out_crx_installer) = 0; |
| 86 | 87 |
| 87 // Look up an extension by ID. Does not include terminated | 88 // DEPRECATED. Use ExtensionRegistry instead. |
|
Yoyo Zhou
2014/07/28 22:00:13
It's really weird to say DEPRECATED 3 times for on
not at google - send to devlin
2014/07/28 22:03:11
maybe :) it's seriously deprecated. I still see CL
| |
| 89 // | |
| 90 // Looks up an extension by its ID. | |
| 91 // | |
| 92 // If |include_disabled| is false then this will only include enabled | |
| 88 // extensions. | 93 // extensions. |
| 94 // | |
| 95 // DEPRECATED: Use | |
| 96 // ExtensionRegistry::enabled_extensions().GetByID(id). | |
| 97 // | |
| 98 // If |include_disabled| is true then this will also include disabled and | |
| 99 // blacklisted extensions (not terminated extensions). | |
| 100 // | |
| 101 // DEPRECATED: Use | |
| 102 // ExtensionRegistry::GetExtensionById( | |
| 103 // id, ExtensionRegistry::ENABLED | | |
| 104 // ExtensionRegistry::DISABLED | | |
| 105 // ExtensionRegistry::BLACKLISTED) | |
| 106 // | |
| 107 // Or don't, because it's probably not something you ever need to know. | |
| 89 virtual const extensions::Extension* GetExtensionById( | 108 virtual const extensions::Extension* GetExtensionById( |
| 90 const std::string& id, | 109 const std::string& id, |
| 91 bool include_disabled) const = 0; | 110 bool include_disabled) const = 0; |
| 92 | 111 |
| 112 // DEPRECATED: Use ExtensionRegistry instead. | |
|
Yoyo Zhou
2014/07/28 22:00:13
Isn't this kind of redundant with 117?
not at google - send to devlin
2014/07/28 22:03:11
ditto
| |
| 113 // | |
| 93 // Looks up an extension by ID, regardless of whether it's enabled, | 114 // Looks up an extension by ID, regardless of whether it's enabled, |
| 94 // disabled, blacklisted, or terminated. | 115 // disabled, blacklisted, or terminated. |
| 95 // DEPRECATED: Replace with: | 116 // |
| 96 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING). | 117 // DEPRECATED: Use |
| 118 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING). | |
| 97 virtual const extensions::Extension* GetInstalledExtension( | 119 virtual const extensions::Extension* GetInstalledExtension( |
| 98 const std::string& id) const = 0; | 120 const std::string& id) const = 0; |
| 99 | 121 |
| 100 // Returns an update for an extension with the specified id, if installation | 122 // Returns an update for an extension with the specified id, if installation |
| 101 // of that update was previously delayed because the extension was in use. If | 123 // of that update was previously delayed because the extension was in use. If |
| 102 // no updates are pending for the extension returns NULL. | 124 // no updates are pending for the extension returns NULL. |
| 103 virtual const extensions::Extension* GetPendingExtensionUpdate( | 125 virtual const extensions::Extension* GetPendingExtensionUpdate( |
| 104 const std::string& extension_id) const = 0; | 126 const std::string& extension_id) const = 0; |
| 105 | 127 |
| 106 // Finishes installation of an update for an extension with the specified id, | 128 // Finishes installation of an update for an extension with the specified id, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 const base::CommandLine* command_line, | 190 const base::CommandLine* command_line, |
| 169 const base::FilePath& install_directory, | 191 const base::FilePath& install_directory, |
| 170 extensions::ExtensionPrefs* extension_prefs, | 192 extensions::ExtensionPrefs* extension_prefs, |
| 171 extensions::Blacklist* blacklist, | 193 extensions::Blacklist* blacklist, |
| 172 bool autoupdate_enabled, | 194 bool autoupdate_enabled, |
| 173 bool extensions_enabled, | 195 bool extensions_enabled, |
| 174 extensions::OneShotEvent* ready); | 196 extensions::OneShotEvent* ready); |
| 175 | 197 |
| 176 virtual ~ExtensionService(); | 198 virtual ~ExtensionService(); |
| 177 | 199 |
| 178 // ExtensionServiceInterface implementation: | 200 // ExtensionServiceInterface implementation. |
| 201 // | |
| 202 // NOTE: Many of these methods are DEPRECATED. See the interface for details. | |
| 179 virtual const extensions::ExtensionSet* extensions() const OVERRIDE; | 203 virtual const extensions::ExtensionSet* extensions() const OVERRIDE; |
| 180 virtual extensions::PendingExtensionManager* | 204 virtual extensions::PendingExtensionManager* |
| 181 pending_extension_manager() OVERRIDE; | 205 pending_extension_manager() OVERRIDE; |
| 182 virtual const extensions::Extension* GetExtensionById( | 206 virtual const extensions::Extension* GetExtensionById( |
| 183 const std::string& id, bool include_disabled) const OVERRIDE; | 207 const std::string& id, bool include_disabled) const OVERRIDE; |
| 184 virtual const extensions::Extension* GetInstalledExtension( | 208 virtual const extensions::Extension* GetInstalledExtension( |
| 185 const std::string& id) const OVERRIDE; | 209 const std::string& id) const OVERRIDE; |
| 186 virtual bool UpdateExtension( | 210 virtual bool UpdateExtension( |
| 187 const std::string& id, | 211 const std::string& id, |
| 188 const base::FilePath& extension_path, | 212 const base::FilePath& extension_path, |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 GreylistedExtensionDisabled); | 724 GreylistedExtensionDisabled); |
| 701 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 725 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 702 GreylistDontEnableManuallyDisabled); | 726 GreylistDontEnableManuallyDisabled); |
| 703 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 727 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 704 GreylistUnknownDontChange); | 728 GreylistUnknownDontChange); |
| 705 | 729 |
| 706 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 730 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 707 }; | 731 }; |
| 708 | 732 |
| 709 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 733 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |