| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/extensions/api/api_resource_manager.h" |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" | 13 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 13 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 14 | 15 |
| 15 class ExtensionDevToolsManager; | 16 class ExtensionDevToolsManager; |
| 16 class ExtensionEventRouter; | 17 class ExtensionEventRouter; |
| 17 class ExtensionInfoMap; | 18 class ExtensionInfoMap; |
| 18 class ExtensionMessageService; | 19 class ExtensionMessageService; |
| 19 class ExtensionNavigationObserver; | 20 class ExtensionNavigationObserver; |
| 20 class ExtensionProcessManager; | 21 class ExtensionProcessManager; |
| 21 class ExtensionService; | 22 class ExtensionService; |
| 22 class Profile; | 23 class Profile; |
| 23 class UserScriptMaster; | 24 class UserScriptMaster; |
| 24 | 25 |
| 25 namespace extensions { | 26 namespace extensions { |
| 26 class AlarmManager; | 27 class AlarmManager; |
| 27 class Extension; | 28 class Extension; |
| 28 class ExtensionPrefs; | 29 class ExtensionPrefs; |
| 29 class ExtensionSystemSharedFactory; | 30 class ExtensionSystemSharedFactory; |
| 30 class LazyBackgroundTaskQueue; | 31 class LazyBackgroundTaskQueue; |
| 31 class ManagementPolicy; | 32 class ManagementPolicy; |
| 32 class RulesRegistryService; | 33 class RulesRegistryService; |
| 34 class SerialConnection; |
| 35 class Socket; |
| 33 class StateStore; | 36 class StateStore; |
| 37 class UsbDeviceResource; |
| 34 | 38 |
| 35 // The ExtensionSystem manages the creation and destruction of services | 39 // The ExtensionSystem manages the creation and destruction of services |
| 36 // related to extensions. Most objects are shared between normal | 40 // related to extensions. Most objects are shared between normal |
| 37 // and incognito Profiles, except as called out in comments. | 41 // and incognito Profiles, except as called out in comments. |
| 38 // This interface supports using TestExtensionSystem for TestingProfiles | 42 // This interface supports using TestExtensionSystem for TestingProfiles |
| 39 // that don't want all of the extensions baggage in their tests. | 43 // that don't want all of the extensions baggage in their tests. |
| 40 class ExtensionSystem : public ProfileKeyedService { | 44 class ExtensionSystem : public ProfileKeyedService { |
| 41 public: | 45 public: |
| 42 ExtensionSystem(); | 46 ExtensionSystem(); |
| 43 virtual ~ExtensionSystem(); | 47 virtual ~ExtensionSystem(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 89 |
| 86 // The ExtensionMessageService is created at startup. | 90 // The ExtensionMessageService is created at startup. |
| 87 virtual ExtensionMessageService* message_service() = 0; | 91 virtual ExtensionMessageService* message_service() = 0; |
| 88 | 92 |
| 89 // The ExtensionEventRouter is created at startup. | 93 // The ExtensionEventRouter is created at startup. |
| 90 virtual ExtensionEventRouter* event_router() = 0; | 94 virtual ExtensionEventRouter* event_router() = 0; |
| 91 | 95 |
| 92 // The RulesRegistryService is created at startup. | 96 // The RulesRegistryService is created at startup. |
| 93 virtual RulesRegistryService* rules_registry_service() = 0; | 97 virtual RulesRegistryService* rules_registry_service() = 0; |
| 94 | 98 |
| 99 // The SerialConnection ResourceManager is created at startup. |
| 100 virtual ApiResourceManager<SerialConnection>* |
| 101 serial_connection_manager() = 0; |
| 102 |
| 103 // The Socket ResourceManager is created at startup. |
| 104 virtual ApiResourceManager<Socket>* |
| 105 socket_manager() = 0; |
| 106 |
| 107 // The UsbDeviceResource ResourceManager is created at startup. |
| 108 virtual ApiResourceManager<UsbDeviceResource>* |
| 109 usb_device_resource_manager() = 0; |
| 110 |
| 95 // Called by the ExtensionService that lives in this system. Gives the | 111 // Called by the ExtensionService that lives in this system. Gives the |
| 96 // info map a chance to react to the load event before the EXTENSION_LOADED | 112 // info map a chance to react to the load event before the EXTENSION_LOADED |
| 97 // notification has fired. The purpose for handling this event first is to | 113 // notification has fired. The purpose for handling this event first is to |
| 98 // avoid race conditions by making sure URLRequestContexts learn about new | 114 // avoid race conditions by making sure URLRequestContexts learn about new |
| 99 // extensions before anything else needs them to know. | 115 // extensions before anything else needs them to know. |
| 100 virtual void RegisterExtensionWithRequestContexts( | 116 virtual void RegisterExtensionWithRequestContexts( |
| 101 const Extension* extension) {} | 117 const Extension* extension) {} |
| 102 | 118 |
| 103 // Called by the ExtensionService that lives in this system. Lets the | 119 // Called by the ExtensionService that lives in this system. Lets the |
| 104 // info map clean up its RequestContexts once all the listeners to the | 120 // info map clean up its RequestContexts once all the listeners to the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 128 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared | 144 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared |
| 129 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; | 145 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; |
| 130 virtual ExtensionProcessManager* process_manager() OVERRIDE; | 146 virtual ExtensionProcessManager* process_manager() OVERRIDE; |
| 131 virtual AlarmManager* alarm_manager() OVERRIDE; | 147 virtual AlarmManager* alarm_manager() OVERRIDE; |
| 132 virtual StateStore* state_store() OVERRIDE; | 148 virtual StateStore* state_store() OVERRIDE; |
| 133 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() | 149 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() |
| 134 OVERRIDE; // shared | 150 OVERRIDE; // shared |
| 135 virtual ExtensionInfoMap* info_map() OVERRIDE; // shared | 151 virtual ExtensionInfoMap* info_map() OVERRIDE; // shared |
| 136 virtual ExtensionMessageService* message_service() OVERRIDE; // shared | 152 virtual ExtensionMessageService* message_service() OVERRIDE; // shared |
| 137 virtual ExtensionEventRouter* event_router() OVERRIDE; // shared | 153 virtual ExtensionEventRouter* event_router() OVERRIDE; // shared |
| 138 // The RulesRegistryService is created at startup. | |
| 139 virtual RulesRegistryService* rules_registry_service() | 154 virtual RulesRegistryService* rules_registry_service() |
| 140 OVERRIDE; // shared | 155 OVERRIDE; // shared |
| 156 virtual ApiResourceManager<SerialConnection>* serial_connection_manager() |
| 157 OVERRIDE; |
| 158 virtual ApiResourceManager<Socket>* socket_manager() OVERRIDE; |
| 159 virtual ApiResourceManager<UsbDeviceResource>* usb_device_resource_manager() |
| 160 OVERRIDE; |
| 141 | 161 |
| 142 virtual void RegisterExtensionWithRequestContexts( | 162 virtual void RegisterExtensionWithRequestContexts( |
| 143 const Extension* extension) OVERRIDE; | 163 const Extension* extension) OVERRIDE; |
| 144 | 164 |
| 145 virtual void UnregisterExtensionWithRequestContexts( | 165 virtual void UnregisterExtensionWithRequestContexts( |
| 146 const std::string& extension_id, | 166 const std::string& extension_id, |
| 147 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; | 167 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; |
| 148 | 168 |
| 149 private: | 169 private: |
| 150 friend class ExtensionSystemSharedFactory; | 170 friend class ExtensionSystemSharedFactory; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 Shared* shared_; | 219 Shared* shared_; |
| 200 | 220 |
| 201 // The services that have their own instances in incognito. | 221 // The services that have their own instances in incognito. |
| 202 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | 222 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
| 203 // |extension_process_manager_| must be destroyed before the Profile's | 223 // |extension_process_manager_| must be destroyed before the Profile's |
| 204 // |io_data_|. While |extension_process_manager_| still lives, we handle | 224 // |io_data_|. While |extension_process_manager_| still lives, we handle |
| 205 // incoming resource requests from extension processes and those require | 225 // incoming resource requests from extension processes and those require |
| 206 // access to the ResourceContext owned by |io_data_|. | 226 // access to the ResourceContext owned by |io_data_|. |
| 207 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | 227 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
| 208 scoped_ptr<AlarmManager> alarm_manager_; | 228 scoped_ptr<AlarmManager> alarm_manager_; |
| 229 scoped_ptr<ApiResourceManager<SerialConnection> > serial_connection_manager_; |
| 230 scoped_ptr<ApiResourceManager<Socket> > socket_manager_; |
| 231 scoped_ptr<ApiResourceManager< |
| 232 UsbDeviceResource> > usb_device_resource_manager_; |
| 209 | 233 |
| 210 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 234 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
| 211 }; | 235 }; |
| 212 | 236 |
| 213 } // namespace extensions | 237 } // namespace extensions |
| 214 | 238 |
| 215 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ | 239 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
| OLD | NEW |