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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class AppNotificationManager; | 49 class AppNotificationManager; |
50 class BookmarkExtensionEventRouter; | 50 class BookmarkExtensionEventRouter; |
51 class ExtensionErrorUI; | 51 class ExtensionErrorUI; |
52 class ExtensionFontSettingsEventRouter; | 52 class ExtensionFontSettingsEventRouter; |
53 class ExtensionManagementEventRouter; | 53 class ExtensionManagementEventRouter; |
54 class ExtensionPreferenceEventRouter; | 54 class ExtensionPreferenceEventRouter; |
55 class ExtensionSyncData; | 55 class ExtensionSyncData; |
56 class ExtensionToolbarModel; | 56 class ExtensionToolbarModel; |
57 class HistoryExtensionEventRouter; | 57 class HistoryExtensionEventRouter; |
58 class GURL; | 58 class GURL; |
59 class PendingExtensionManager; | |
60 class Profile; | 59 class Profile; |
61 class Version; | 60 class Version; |
62 | 61 |
63 namespace chromeos { | 62 namespace chromeos { |
64 class ExtensionBluetoothEventRouter; | 63 class ExtensionBluetoothEventRouter; |
65 class ExtensionInputMethodEventRouter; | 64 class ExtensionInputMethodEventRouter; |
66 } | 65 } |
67 | 66 |
68 namespace extensions { | 67 namespace extensions { |
69 class AppSyncData; | 68 class AppSyncData; |
70 class BrowserEventRouter; | 69 class BrowserEventRouter; |
71 class ComponentLoader; | 70 class ComponentLoader; |
72 class ContentSettingsStore; | 71 class ContentSettingsStore; |
73 class CrxInstaller; | 72 class CrxInstaller; |
74 class Extension; | 73 class Extension; |
75 class ExtensionCookiesEventRouter; | 74 class ExtensionCookiesEventRouter; |
76 class ExtensionManagedModeEventRouter; | 75 class ExtensionManagedModeEventRouter; |
77 class ExtensionSyncData; | 76 class ExtensionSyncData; |
78 class ExtensionSystem; | 77 class ExtensionSystem; |
79 class ExtensionUpdater; | 78 class ExtensionUpdater; |
| 79 class PendingExtensionManager; |
80 class SettingsFrontend; | 80 class SettingsFrontend; |
81 class WebNavigationEventRouter; | 81 class WebNavigationEventRouter; |
82 class WindowEventRouter; | 82 class WindowEventRouter; |
83 } | 83 } |
84 | 84 |
85 namespace syncer { | 85 namespace syncer { |
86 class SyncData; | 86 class SyncData; |
87 class SyncErrorFactory; | 87 class SyncErrorFactory; |
88 } | 88 } |
89 | 89 |
90 namespace syncer { | |
91 class SyncData; | |
92 class SyncErrorFactory; | |
93 } | |
94 | |
95 // This is an interface class to encapsulate the dependencies that | 90 // This is an interface class to encapsulate the dependencies that |
96 // various classes have on ExtensionService. This allows easy mocking. | 91 // various classes have on ExtensionService. This allows easy mocking. |
97 class ExtensionServiceInterface : public syncer::SyncableService { | 92 class ExtensionServiceInterface : public syncer::SyncableService { |
98 public: | 93 public: |
99 // A function that returns true if the given extension should be | 94 // A function that returns true if the given extension should be |
100 // included and false if it should be filtered out. Identical to | 95 // included and false if it should be filtered out. Identical to |
101 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 96 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
102 typedef bool (*ExtensionFilter)(const extensions::Extension&); | 97 typedef bool (*ExtensionFilter)(const extensions::Extension&); |
103 | 98 |
104 virtual ~ExtensionServiceInterface() {} | 99 virtual ~ExtensionServiceInterface() {} |
105 virtual const ExtensionSet* extensions() const = 0; | 100 virtual const ExtensionSet* extensions() const = 0; |
106 virtual const ExtensionSet* disabled_extensions() const = 0; | 101 virtual const ExtensionSet* disabled_extensions() const = 0; |
107 virtual PendingExtensionManager* pending_extension_manager() = 0; | 102 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0; |
108 | 103 |
109 // Install an update. Return true if the install can be started. | 104 // Install an update. Return true if the install can be started. |
110 // Set out_crx_installer to the installer if one was started. | 105 // Set out_crx_installer to the installer if one was started. |
111 virtual bool UpdateExtension( | 106 virtual bool UpdateExtension( |
112 const std::string& id, | 107 const std::string& id, |
113 const FilePath& path, | 108 const FilePath& path, |
114 const GURL& download_url, | 109 const GURL& download_url, |
115 extensions::CrxInstaller** out_crx_installer) = 0; | 110 extensions::CrxInstaller** out_crx_installer) = 0; |
116 virtual const extensions::Extension* GetExtensionById(const std::string& id, | 111 virtual const extensions::Extension* GetExtensionById(const std::string& id, |
117 bool include_disabled) const = 0; | 112 bool include_disabled) const = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Gets the list of currently installed extensions. | 206 // Gets the list of currently installed extensions. |
212 virtual const ExtensionSet* extensions() const OVERRIDE; | 207 virtual const ExtensionSet* extensions() const OVERRIDE; |
213 virtual const ExtensionSet* disabled_extensions() const OVERRIDE; | 208 virtual const ExtensionSet* disabled_extensions() const OVERRIDE; |
214 const ExtensionSet* terminated_extensions() const; | 209 const ExtensionSet* terminated_extensions() const; |
215 | 210 |
216 // Retuns a set of all installed, disabled, and terminated extensions and | 211 // Retuns a set of all installed, disabled, and terminated extensions and |
217 // transfers ownership to caller. | 212 // transfers ownership to caller. |
218 const ExtensionSet* GenerateInstalledExtensionsSet() const; | 213 const ExtensionSet* GenerateInstalledExtensionsSet() const; |
219 | 214 |
220 // Gets the object managing the set of pending extensions. | 215 // Gets the object managing the set of pending extensions. |
221 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE; | 216 virtual extensions::PendingExtensionManager* |
| 217 pending_extension_manager() OVERRIDE; |
222 | 218 |
223 const FilePath& install_directory() const { return install_directory_; } | 219 const FilePath& install_directory() const { return install_directory_; } |
224 | 220 |
225 AppsPromo* apps_promo() { return &apps_promo_; } | 221 AppsPromo* apps_promo() { return &apps_promo_; } |
226 | 222 |
227 extensions::ProcessMap* process_map() { return &process_map_; } | 223 extensions::ProcessMap* process_map() { return &process_map_; } |
228 | 224 |
229 // Whether this extension can run in an incognito window. | 225 // Whether this extension can run in an incognito window. |
230 virtual bool IsIncognitoEnabled(const std::string& extension_id) const; | 226 virtual bool IsIncognitoEnabled(const std::string& extension_id) const; |
231 virtual void SetIsIncognitoEnabled(const std::string& extension_id, | 227 virtual void SetIsIncognitoEnabled(const std::string& extension_id, |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 // The current list of installed extensions. | 721 // The current list of installed extensions. |
726 ExtensionSet extensions_; | 722 ExtensionSet extensions_; |
727 | 723 |
728 // The list of installed extensions that have been disabled. | 724 // The list of installed extensions that have been disabled. |
729 ExtensionSet disabled_extensions_; | 725 ExtensionSet disabled_extensions_; |
730 | 726 |
731 // The list of installed extensions that have been terminated. | 727 // The list of installed extensions that have been terminated. |
732 ExtensionSet terminated_extensions_; | 728 ExtensionSet terminated_extensions_; |
733 | 729 |
734 // Hold the set of pending extensions. | 730 // Hold the set of pending extensions. |
735 PendingExtensionManager pending_extension_manager_; | 731 extensions::PendingExtensionManager pending_extension_manager_; |
736 | 732 |
737 // The map of extension IDs to their runtime data. | 733 // The map of extension IDs to their runtime data. |
738 ExtensionRuntimeDataMap extension_runtime_data_; | 734 ExtensionRuntimeDataMap extension_runtime_data_; |
739 | 735 |
740 // Holds a map between renderer process IDs that are associated with an | 736 // Holds a map between renderer process IDs that are associated with an |
741 // installed app and their app. | 737 // installed app and their app. |
742 typedef std::map<int, scoped_refptr<const extensions::Extension> > | 738 typedef std::map<int, scoped_refptr<const extensions::Extension> > |
743 InstalledAppMap; | 739 InstalledAppMap; |
744 InstalledAppMap installed_app_hosts_; | 740 InstalledAppMap installed_app_hosts_; |
745 | 741 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 scoped_ptr<ExtensionErrorUI> extension_error_ui_; | 854 scoped_ptr<ExtensionErrorUI> extension_error_ui_; |
859 | 855 |
860 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 856 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
861 InstallAppsWithUnlimtedStorage); | 857 InstallAppsWithUnlimtedStorage); |
862 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 858 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
863 InstallAppsAndCheckStorageProtection); | 859 InstallAppsAndCheckStorageProtection); |
864 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 860 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
865 }; | 861 }; |
866 | 862 |
867 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 863 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |