| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Returns the instance for the given profile, or NULL if none. This is | 51 // Returns the instance for the given profile, or NULL if none. This is |
| 52 // a convenience wrapper around ExtensionSystemFactory::GetForProfile. | 52 // a convenience wrapper around ExtensionSystemFactory::GetForProfile. |
| 53 static ExtensionSystem* Get(Profile* profile); | 53 static ExtensionSystem* Get(Profile* profile); |
| 54 | 54 |
| 55 // ProfileKeyedService implementation. | 55 // ProfileKeyedService implementation. |
| 56 virtual void Shutdown() OVERRIDE {} | 56 virtual void Shutdown() OVERRIDE {} |
| 57 | 57 |
| 58 // Initializes extensions machinery. | 58 // Initializes extensions machinery. |
| 59 // Component extensions are always enabled, external and user extensions | 59 // Component extensions are always enabled, external and user extensions |
| 60 // are controlled by |extensions_enabled|. | 60 // are controlled by |extensions_enabled|. |
| 61 virtual void Init(bool extensions_enabled) = 0; | 61 virtual void InitForRegularProfile(bool extensions_enabled) = 0; |
| 62 |
| 63 virtual void InitForOTRProfile() = 0; |
| 62 | 64 |
| 63 // The ExtensionService is created at startup. | 65 // The ExtensionService is created at startup. |
| 64 virtual ExtensionService* extension_service() = 0; | 66 virtual ExtensionService* extension_service() = 0; |
| 65 | 67 |
| 66 // The class controlling whether users are permitted to perform certain | 68 // The class controlling whether users are permitted to perform certain |
| 67 // actions on extensions (install, uninstall, disable, etc.). | 69 // actions on extensions (install, uninstall, disable, etc.). |
| 68 // The ManagementPolicy is created at startup. | 70 // The ManagementPolicy is created at startup. |
| 69 virtual ManagementPolicy* management_policy() = 0; | 71 virtual ManagementPolicy* management_policy() = 0; |
| 70 | 72 |
| 71 // The ExtensionDevToolsManager is created at startup. | 73 // The ExtensionDevToolsManager is created at startup. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // instances. A private Shared class (also a ProfileKeyedService, | 134 // instances. A private Shared class (also a ProfileKeyedService, |
| 133 // but with a shared instance for incognito) keeps the common services. | 135 // but with a shared instance for incognito) keeps the common services. |
| 134 class ExtensionSystemImpl : public ExtensionSystem { | 136 class ExtensionSystemImpl : public ExtensionSystem { |
| 135 public: | 137 public: |
| 136 explicit ExtensionSystemImpl(Profile* profile); | 138 explicit ExtensionSystemImpl(Profile* profile); |
| 137 virtual ~ExtensionSystemImpl(); | 139 virtual ~ExtensionSystemImpl(); |
| 138 | 140 |
| 139 // ProfileKeyedService implementation. | 141 // ProfileKeyedService implementation. |
| 140 virtual void Shutdown() OVERRIDE; | 142 virtual void Shutdown() OVERRIDE; |
| 141 | 143 |
| 142 virtual void Init(bool extensions_enabled) OVERRIDE; | 144 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; |
| 145 virtual void InitForOTRProfile() OVERRIDE; |
| 143 | 146 |
| 144 virtual ExtensionService* extension_service() OVERRIDE; // shared | 147 virtual ExtensionService* extension_service() OVERRIDE; // shared |
| 145 virtual ManagementPolicy* management_policy() OVERRIDE; // shared | 148 virtual ManagementPolicy* management_policy() OVERRIDE; // shared |
| 146 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared | 149 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared |
| 147 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; | 150 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; |
| 148 virtual ExtensionProcessManager* process_manager() OVERRIDE; | 151 virtual ExtensionProcessManager* process_manager() OVERRIDE; |
| 149 virtual AlarmManager* alarm_manager() OVERRIDE; | 152 virtual AlarmManager* alarm_manager() OVERRIDE; |
| 150 virtual StateStore* state_store() OVERRIDE; | 153 virtual StateStore* state_store() OVERRIDE; |
| 151 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() | 154 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() |
| 152 OVERRIDE; // shared | 155 OVERRIDE; // shared |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void Init(bool extensions_enabled); | 189 void Init(bool extensions_enabled); |
| 187 | 190 |
| 188 StateStore* state_store(); | 191 StateStore* state_store(); |
| 189 ExtensionService* extension_service(); | 192 ExtensionService* extension_service(); |
| 190 ManagementPolicy* management_policy(); | 193 ManagementPolicy* management_policy(); |
| 191 UserScriptMaster* user_script_master(); | 194 UserScriptMaster* user_script_master(); |
| 192 ExtensionInfoMap* info_map(); | 195 ExtensionInfoMap* info_map(); |
| 193 LazyBackgroundTaskQueue* lazy_background_task_queue(); | 196 LazyBackgroundTaskQueue* lazy_background_task_queue(); |
| 194 ExtensionMessageService* message_service(); | 197 ExtensionMessageService* message_service(); |
| 195 EventRouter* event_router(); | 198 EventRouter* event_router(); |
| 196 RulesRegistryService* rules_registry_service(); | |
| 197 | 199 |
| 198 private: | 200 private: |
| 199 Profile* profile_; | 201 Profile* profile_; |
| 200 | 202 |
| 201 // The services that are shared between normal and incognito profiles. | 203 // The services that are shared between normal and incognito profiles. |
| 202 | 204 |
| 203 scoped_ptr<StateStore> state_store_; | 205 scoped_ptr<StateStore> state_store_; |
| 204 scoped_ptr<ExtensionPrefs> extension_prefs_; | 206 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 205 // ExtensionService depends on the 2 above. | 207 // ExtensionService depends on the 2 above. |
| 206 scoped_ptr<ExtensionService> extension_service_; | 208 scoped_ptr<ExtensionService> extension_service_; |
| 207 scoped_ptr<ManagementPolicy> management_policy_; | 209 scoped_ptr<ManagementPolicy> management_policy_; |
| 208 scoped_refptr<UserScriptMaster> user_script_master_; | 210 scoped_refptr<UserScriptMaster> user_script_master_; |
| 209 // extension_info_map_ needs to outlive extension_process_manager_. | 211 // extension_info_map_ needs to outlive extension_process_manager_. |
| 210 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 212 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 211 // This is a dependency of ExtensionMessageService and EventRouter. | 213 // This is a dependency of ExtensionMessageService and EventRouter. |
| 212 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; | 214 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; |
| 213 scoped_ptr<ExtensionMessageService> extension_message_service_; | 215 scoped_ptr<ExtensionMessageService> extension_message_service_; |
| 214 scoped_ptr<EventRouter> extension_event_router_; | 216 scoped_ptr<EventRouter> extension_event_router_; |
| 215 scoped_ptr<ExtensionNavigationObserver> extension_navigation_observer_; | 217 scoped_ptr<ExtensionNavigationObserver> extension_navigation_observer_; |
| 216 scoped_ptr<RulesRegistryService> rules_registry_service_; | |
| 217 }; | 218 }; |
| 218 | 219 |
| 219 Profile* profile_; | 220 Profile* profile_; |
| 220 | 221 |
| 221 Shared* shared_; | 222 Shared* shared_; |
| 222 | 223 |
| 223 // The services that have their own instances in incognito. | 224 // The services that have their own instances in incognito. |
| 224 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | 225 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
| 225 // |extension_process_manager_| must be destroyed before the Profile's | 226 // |extension_process_manager_| must be destroyed before the Profile's |
| 226 // |io_data_|. While |extension_process_manager_| still lives, we handle | 227 // |io_data_|. While |extension_process_manager_| still lives, we handle |
| 227 // incoming resource requests from extension processes and those require | 228 // incoming resource requests from extension processes and those require |
| 228 // access to the ResourceContext owned by |io_data_|. | 229 // access to the ResourceContext owned by |io_data_|. |
| 229 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | 230 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
| 230 scoped_ptr<AlarmManager> alarm_manager_; | 231 scoped_ptr<AlarmManager> alarm_manager_; |
| 231 scoped_ptr<ApiResourceManager<SerialConnection> > serial_connection_manager_; | 232 scoped_ptr<ApiResourceManager<SerialConnection> > serial_connection_manager_; |
| 232 scoped_ptr<ApiResourceManager<Socket> > socket_manager_; | 233 scoped_ptr<ApiResourceManager<Socket> > socket_manager_; |
| 233 scoped_ptr<ApiResourceManager< | 234 scoped_ptr<ApiResourceManager< |
| 234 UsbDeviceResource> > usb_device_resource_manager_; | 235 UsbDeviceResource> > usb_device_resource_manager_; |
| 236 scoped_ptr<RulesRegistryService> rules_registry_service_; |
| 235 | 237 |
| 236 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 238 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
| 237 }; | 239 }; |
| 238 | 240 |
| 239 } // namespace extensions | 241 } // namespace extensions |
| 240 | 242 |
| 241 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ | 243 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
| OLD | NEW |