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