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_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 class RulesRegistryService; | 39 class RulesRegistryService; |
40 class StandardManagementPolicyProvider; | 40 class StandardManagementPolicyProvider; |
41 class StateStore; | 41 class StateStore; |
42 class UserScriptMaster; | 42 class UserScriptMaster; |
43 | 43 |
44 // The ExtensionSystem manages the creation and destruction of services | 44 // The ExtensionSystem manages the creation and destruction of services |
45 // related to extensions. Most objects are shared between normal | 45 // related to extensions. Most objects are shared between normal |
46 // and incognito Profiles, except as called out in comments. | 46 // and incognito Profiles, except as called out in comments. |
47 // This interface supports using TestExtensionSystem for TestingProfiles | 47 // This interface supports using TestExtensionSystem for TestingProfiles |
48 // that don't want all of the extensions baggage in their tests. | 48 // that don't want all of the extensions baggage in their tests. |
49 class ExtensionSystem : public ProfileKeyedService { | 49 class ExtensionSystem : public BrowserContextKeyedService { |
50 public: | 50 public: |
51 ExtensionSystem(); | 51 ExtensionSystem(); |
52 virtual ~ExtensionSystem(); | 52 virtual ~ExtensionSystem(); |
53 | 53 |
54 // Returns the instance for the given profile, or NULL if none. This is | 54 // Returns the instance for the given profile, or NULL if none. This is |
55 // a convenience wrapper around ExtensionSystemFactory::GetForProfile. | 55 // a convenience wrapper around ExtensionSystemFactory::GetForProfile. |
56 static ExtensionSystem* Get(Profile* profile); | 56 static ExtensionSystem* Get(Profile* profile); |
57 | 57 |
58 // ProfileKeyedService implementation. | 58 // BrowserContextKeyedService implementation. |
59 virtual void Shutdown() OVERRIDE {} | 59 virtual void Shutdown() OVERRIDE {} |
60 | 60 |
61 // Initializes extensions machinery. | 61 // Initializes extensions machinery. |
62 // Component extensions are always enabled, external and user extensions | 62 // Component extensions are always enabled, external and user extensions |
63 // are controlled by |extensions_enabled|. | 63 // are controlled by |extensions_enabled|. |
64 virtual void InitForRegularProfile(bool extensions_enabled) = 0; | 64 virtual void InitForRegularProfile(bool extensions_enabled) = 0; |
65 | 65 |
66 virtual void InitForOTRProfile() = 0; | 66 virtual void InitForOTRProfile() = 0; |
67 | 67 |
68 // The ExtensionService is created at startup. | 68 // The ExtensionService is created at startup. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 virtual void UnregisterExtensionWithRequestContexts( | 129 virtual void UnregisterExtensionWithRequestContexts( |
130 const std::string& extension_id, | 130 const std::string& extension_id, |
131 const extension_misc::UnloadedExtensionReason reason) {} | 131 const extension_misc::UnloadedExtensionReason reason) {} |
132 | 132 |
133 // Signaled when the extension system has completed its startup tasks. | 133 // Signaled when the extension system has completed its startup tasks. |
134 virtual const OneShotEvent& ready() const = 0; | 134 virtual const OneShotEvent& ready() const = 0; |
135 }; | 135 }; |
136 | 136 |
137 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. | 137 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. |
138 // Implementation details: non-shared services are owned by | 138 // Implementation details: non-shared services are owned by |
139 // ExtensionSystemImpl, a ProfileKeyedService with separate incognito | 139 // ExtensionSystemImpl, a BrowserContextKeyedService with separate incognito |
140 // instances. A private Shared class (also a ProfileKeyedService, | 140 // instances. A private Shared class (also a BrowserContextKeyedService, |
141 // but with a shared instance for incognito) keeps the common services. | 141 // but with a shared instance for incognito) keeps the common services. |
142 class ExtensionSystemImpl : public ExtensionSystem { | 142 class ExtensionSystemImpl : public ExtensionSystem { |
143 public: | 143 public: |
144 explicit ExtensionSystemImpl(Profile* profile); | 144 explicit ExtensionSystemImpl(Profile* profile); |
145 virtual ~ExtensionSystemImpl(); | 145 virtual ~ExtensionSystemImpl(); |
146 | 146 |
147 // ProfileKeyedService implementation. | 147 // BrowserContextKeyedService implementation. |
148 virtual void Shutdown() OVERRIDE; | 148 virtual void Shutdown() OVERRIDE; |
149 | 149 |
150 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; | 150 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; |
151 virtual void InitForOTRProfile() OVERRIDE; | 151 virtual void InitForOTRProfile() OVERRIDE; |
152 | 152 |
153 virtual ExtensionService* extension_service() OVERRIDE; // shared | 153 virtual ExtensionService* extension_service() OVERRIDE; // shared |
154 virtual ManagementPolicy* management_policy() OVERRIDE; // shared | 154 virtual ManagementPolicy* management_policy() OVERRIDE; // shared |
155 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared | 155 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared |
156 virtual ExtensionProcessManager* process_manager() OVERRIDE; | 156 virtual ExtensionProcessManager* process_manager() OVERRIDE; |
157 virtual StateStore* state_store() OVERRIDE; // shared | 157 virtual StateStore* state_store() OVERRIDE; // shared |
(...skipping 19 matching lines...) Expand all Loading... |
177 const std::string& extension_id, | 177 const std::string& extension_id, |
178 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; | 178 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; |
179 | 179 |
180 virtual const OneShotEvent& ready() const OVERRIDE; | 180 virtual const OneShotEvent& ready() const OVERRIDE; |
181 | 181 |
182 private: | 182 private: |
183 friend class ExtensionSystemSharedFactory; | 183 friend class ExtensionSystemSharedFactory; |
184 | 184 |
185 // Owns the Extension-related systems that have a single instance | 185 // Owns the Extension-related systems that have a single instance |
186 // shared between normal and incognito profiles. | 186 // shared between normal and incognito profiles. |
187 class Shared : public ProfileKeyedService { | 187 class Shared : public BrowserContextKeyedService { |
188 public: | 188 public: |
189 explicit Shared(Profile* profile); | 189 explicit Shared(Profile* profile); |
190 virtual ~Shared(); | 190 virtual ~Shared(); |
191 | 191 |
192 // Initialization takes place in phases. | 192 // Initialization takes place in phases. |
193 virtual void InitPrefs(); | 193 virtual void InitPrefs(); |
194 // This must not be called until all the providers have been created. | 194 // This must not be called until all the providers have been created. |
195 void RegisterManagementPolicyProviders(); | 195 void RegisterManagementPolicyProviders(); |
196 void Init(bool extensions_enabled); | 196 void Init(bool extensions_enabled); |
197 | 197 |
198 // ProfileKeyedService implementation. | 198 // BrowserContextKeyedService implementation. |
199 virtual void Shutdown() OVERRIDE; | 199 virtual void Shutdown() OVERRIDE; |
200 | 200 |
201 StateStore* state_store(); | 201 StateStore* state_store(); |
202 StateStore* rules_store(); | 202 StateStore* rules_store(); |
203 ExtensionService* extension_service(); | 203 ExtensionService* extension_service(); |
204 ManagementPolicy* management_policy(); | 204 ManagementPolicy* management_policy(); |
205 UserScriptMaster* user_script_master(); | 205 UserScriptMaster* user_script_master(); |
206 Blacklist* blacklist(); | 206 Blacklist* blacklist(); |
207 ExtensionInfoMap* info_map(); | 207 ExtensionInfoMap* info_map(); |
208 LazyBackgroundTaskQueue* lazy_background_task_queue(); | 208 LazyBackgroundTaskQueue* lazy_background_task_queue(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 scoped_ptr<ApiResourceManager< | 252 scoped_ptr<ApiResourceManager< |
253 UsbDeviceResource> > usb_device_resource_manager_; | 253 UsbDeviceResource> > usb_device_resource_manager_; |
254 scoped_ptr<RulesRegistryService> rules_registry_service_; | 254 scoped_ptr<RulesRegistryService> rules_registry_service_; |
255 | 255 |
256 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 256 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
257 }; | 257 }; |
258 | 258 |
259 } // namespace extensions | 259 } // namespace extensions |
260 | 260 |
261 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ | 261 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
OLD | NEW |