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. |
88 // extensions. | 89 // |
90 // Looks up an extension by its ID. | |
91 // | |
92 // If |include_disabled| is false then this will only include enabled | |
93 // extensions. Equivalent to: | |
Yoyo Zhou
2014/07/28 22:21:04
Say "Use instead" instead of "equivalent to"
not at google - send to devlin
2014/07/28 22:23:04
Done, though I had "equivalent to" because the rep
| |
94 // | |
95 // ExtensionRegistry::enabled_extensions().GetByID(id). | |
96 // | |
97 // If |include_disabled| is true then this will also include disabled and | |
98 // blacklisted extensions (not terminated extensions). Equivalent to: | |
99 // | |
100 // ExtensionRegistry::GetExtensionById( | |
101 // id, ExtensionRegistry::ENABLED | | |
102 // ExtensionRegistry::DISABLED | | |
103 // ExtensionRegistry::BLACKLISTED) | |
104 // | |
105 // Or don't, because it's probably not something you ever need to know. | |
89 virtual const extensions::Extension* GetExtensionById( | 106 virtual const extensions::Extension* GetExtensionById( |
90 const std::string& id, | 107 const std::string& id, |
91 bool include_disabled) const = 0; | 108 bool include_disabled) const = 0; |
92 | 109 |
110 // DEPRECATED: Use ExtensionRegistry instead. | |
111 // | |
93 // Looks up an extension by ID, regardless of whether it's enabled, | 112 // Looks up an extension by ID, regardless of whether it's enabled, |
94 // disabled, blacklisted, or terminated. | 113 // disabled, blacklisted, or terminated. Equivalent to: |
95 // DEPRECATED: Replace with: | 114 // |
96 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING). | 115 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING). |
97 virtual const extensions::Extension* GetInstalledExtension( | 116 virtual const extensions::Extension* GetInstalledExtension( |
98 const std::string& id) const = 0; | 117 const std::string& id) const = 0; |
99 | 118 |
100 // Returns an update for an extension with the specified id, if installation | 119 // 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 | 120 // of that update was previously delayed because the extension was in use. If |
102 // no updates are pending for the extension returns NULL. | 121 // no updates are pending for the extension returns NULL. |
103 virtual const extensions::Extension* GetPendingExtensionUpdate( | 122 virtual const extensions::Extension* GetPendingExtensionUpdate( |
104 const std::string& extension_id) const = 0; | 123 const std::string& extension_id) const = 0; |
105 | 124 |
106 // Finishes installation of an update for an extension with the specified id, | 125 // 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, | 187 const base::CommandLine* command_line, |
169 const base::FilePath& install_directory, | 188 const base::FilePath& install_directory, |
170 extensions::ExtensionPrefs* extension_prefs, | 189 extensions::ExtensionPrefs* extension_prefs, |
171 extensions::Blacklist* blacklist, | 190 extensions::Blacklist* blacklist, |
172 bool autoupdate_enabled, | 191 bool autoupdate_enabled, |
173 bool extensions_enabled, | 192 bool extensions_enabled, |
174 extensions::OneShotEvent* ready); | 193 extensions::OneShotEvent* ready); |
175 | 194 |
176 virtual ~ExtensionService(); | 195 virtual ~ExtensionService(); |
177 | 196 |
178 // ExtensionServiceInterface implementation: | 197 // ExtensionServiceInterface implementation. |
198 // | |
199 // NOTE: Many of these methods are DEPRECATED. See the interface for details. | |
179 virtual const extensions::ExtensionSet* extensions() const OVERRIDE; | 200 virtual const extensions::ExtensionSet* extensions() const OVERRIDE; |
180 virtual extensions::PendingExtensionManager* | 201 virtual extensions::PendingExtensionManager* |
181 pending_extension_manager() OVERRIDE; | 202 pending_extension_manager() OVERRIDE; |
182 virtual const extensions::Extension* GetExtensionById( | 203 virtual const extensions::Extension* GetExtensionById( |
183 const std::string& id, bool include_disabled) const OVERRIDE; | 204 const std::string& id, bool include_disabled) const OVERRIDE; |
184 virtual const extensions::Extension* GetInstalledExtension( | 205 virtual const extensions::Extension* GetInstalledExtension( |
185 const std::string& id) const OVERRIDE; | 206 const std::string& id) const OVERRIDE; |
186 virtual bool UpdateExtension( | 207 virtual bool UpdateExtension( |
187 const std::string& id, | 208 const std::string& id, |
188 const base::FilePath& extension_path, | 209 const base::FilePath& extension_path, |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 GreylistedExtensionDisabled); | 721 GreylistedExtensionDisabled); |
701 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 722 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
702 GreylistDontEnableManuallyDisabled); | 723 GreylistDontEnableManuallyDisabled); |
703 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 724 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
704 GreylistUnknownDontChange); | 725 GreylistUnknownDontChange); |
705 | 726 |
706 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 727 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
707 }; | 728 }; |
708 | 729 |
709 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 730 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |