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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void FinishVerifyAllExtensions(bool success); | 220 void FinishVerifyAllExtensions(bool success); |
221 | 221 |
222 // Called when the associated Profile is going to be destroyed. | 222 // Called when the associated Profile is going to be destroyed. |
223 void Shutdown(); | 223 void Shutdown(); |
224 | 224 |
225 // Look up an extension by ID. Does not include terminated | 225 // Look up an extension by ID. Does not include terminated |
226 // extensions. | 226 // extensions. |
227 virtual const extensions::Extension* GetExtensionById( | 227 virtual const extensions::Extension* GetExtensionById( |
228 const std::string& id, bool include_disabled) const OVERRIDE; | 228 const std::string& id, bool include_disabled) const OVERRIDE; |
229 | 229 |
230 enum IncludeFlag { | |
231 INCLUDE_NONE = 0, | |
232 INCLUDE_ENABLED = 1 << 0, | |
233 INCLUDE_DISABLED = 1 << 1, | |
234 INCLUDE_TERMINATED = 1 << 2, | |
235 INCLUDE_BLACKLISTED = 1 << 3, | |
236 INCLUDE_EVERYTHING = (1 << 4) - 1, | |
237 }; | |
238 | |
239 // Look up an extension by ID, selecting which sets to look in: | |
240 // * extensions() --> INCLUDE_ENABLED | |
241 // * disabled_extensions() --> INCLUDE_DISABLED | |
242 // * terminated_extensions() --> INCLUDE_TERMINATED | |
243 // * blacklisted_extensions() --> INCLUDE_BLACKLISTED | |
244 const extensions::Extension* GetExtensionById(const std::string& id, | |
245 int include_mask) const; | |
246 | |
247 // Returns the site of the given |extension_id|. Suitable for use with | 230 // Returns the site of the given |extension_id|. Suitable for use with |
248 // BrowserContext::GetStoragePartitionForSite(). | 231 // BrowserContext::GetStoragePartitionForSite(). |
249 GURL GetSiteForExtensionId(const std::string& extension_id); | 232 GURL GetSiteForExtensionId(const std::string& extension_id); |
250 | 233 |
251 // Looks up a terminated (crashed) extension by ID. | 234 // Looks up a terminated (crashed) extension by ID. |
252 const extensions::Extension* | 235 const extensions::Extension* |
253 GetTerminatedExtension(const std::string& id) const; | 236 GetTerminatedExtension(const std::string& id) const; |
254 | 237 |
255 // Looks up an extension by ID, regardless of whether it's enabled, | 238 // Looks up an extension by ID, regardless of whether it's enabled, |
256 // disabled, blacklisted, or terminated. | 239 // disabled, blacklisted, or terminated. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 void set_show_extensions_prompts(bool enabled) { | 413 void set_show_extensions_prompts(bool enabled) { |
431 show_extensions_prompts_ = enabled; | 414 show_extensions_prompts_ = enabled; |
432 } | 415 } |
433 | 416 |
434 bool show_extensions_prompts() { | 417 bool show_extensions_prompts() { |
435 return show_extensions_prompts_; | 418 return show_extensions_prompts_; |
436 } | 419 } |
437 | 420 |
438 Profile* profile(); | 421 Profile* profile(); |
439 | 422 |
| 423 // Returns profile_ as a BrowserContext. |
| 424 content::BrowserContext* GetBrowserContext() const; |
| 425 |
440 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, | 426 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, |
441 // ExtensionPrefs* mutable_extension_prefs(). | 427 // ExtensionPrefs* mutable_extension_prefs(). |
442 extensions::ExtensionPrefs* extension_prefs(); | 428 extensions::ExtensionPrefs* extension_prefs(); |
443 const extensions::ExtensionPrefs* extension_prefs() const; | 429 const extensions::ExtensionPrefs* extension_prefs() const; |
444 | 430 |
445 extensions::SettingsFrontend* settings_frontend(); | 431 extensions::SettingsFrontend* settings_frontend(); |
446 | 432 |
447 void set_extension_sync_service( | 433 void set_extension_sync_service( |
448 ExtensionSyncService* extension_sync_service) { | 434 ExtensionSyncService* extension_sync_service) { |
449 extension_sync_service_ = extension_sync_service; | 435 extension_sync_service_ = extension_sync_service; |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 #endif | 845 #endif |
860 | 846 |
861 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 847 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
862 InstallAppsWithUnlimtedStorage); | 848 InstallAppsWithUnlimtedStorage); |
863 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 849 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
864 InstallAppsAndCheckStorageProtection); | 850 InstallAppsAndCheckStorageProtection); |
865 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 851 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
866 }; | 852 }; |
867 | 853 |
868 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 854 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |