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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/profiles/profile_keyed_service.h" | 13 #include "chrome/browser/profiles/profile_keyed_service.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
15 | 15 |
16 class Extension; | |
17 class ExtensionDevToolsManager; | 16 class ExtensionDevToolsManager; |
18 class ExtensionEventRouter; | 17 class ExtensionEventRouter; |
19 class ExtensionInfoMap; | 18 class ExtensionInfoMap; |
20 class ExtensionMessageService; | 19 class ExtensionMessageService; |
21 class ExtensionNavigationObserver; | 20 class ExtensionNavigationObserver; |
22 class ExtensionPrefs; | 21 class ExtensionPrefs; |
23 class ExtensionProcessManager; | 22 class ExtensionProcessManager; |
24 class ExtensionService; | 23 class ExtensionService; |
25 class Profile; | 24 class Profile; |
26 class UserScriptMaster; | 25 class UserScriptMaster; |
27 | 26 |
28 namespace extensions { | 27 namespace extensions { |
29 class AlarmManager; | 28 class AlarmManager; |
| 29 class Extension; |
30 class LazyBackgroundTaskQueue; | 30 class LazyBackgroundTaskQueue; |
31 class RulesRegistryService; | 31 class RulesRegistryService; |
32 } | 32 } |
33 | 33 |
34 // The ExtensionSystem manages the creation and destruction of services | 34 // The ExtensionSystem manages the creation and destruction of services |
35 // related to extensions. Most objects are shared between normal | 35 // related to extensions. Most objects are shared between normal |
36 // and incognito Profiles, except as called out in comments. | 36 // and incognito Profiles, except as called out in comments. |
37 // This interface supports using TestExtensionSystem for TestingProfiles | 37 // This interface supports using TestExtensionSystem for TestingProfiles |
38 // that don't want all of the extensions baggage in their tests. | 38 // that don't want all of the extensions baggage in their tests. |
39 class ExtensionSystem : public ProfileKeyedService { | 39 class ExtensionSystem : public ProfileKeyedService { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // The RulesRegistryService is created at startup. | 83 // The RulesRegistryService is created at startup. |
84 virtual extensions::RulesRegistryService* rules_registry_service() = 0; | 84 virtual extensions::RulesRegistryService* rules_registry_service() = 0; |
85 | 85 |
86 // Called by the ExtensionService that lives in this system. Gives the | 86 // Called by the ExtensionService that lives in this system. Gives the |
87 // info map a chance to react to the load event before the EXTENSION_LOADED | 87 // info map a chance to react to the load event before the EXTENSION_LOADED |
88 // notification has fired. The purpose for handling this event first is to | 88 // notification has fired. The purpose for handling this event first is to |
89 // avoid race conditions by making sure URLRequestContexts learn about new | 89 // avoid race conditions by making sure URLRequestContexts learn about new |
90 // extensions before anything else needs them to know. | 90 // extensions before anything else needs them to know. |
91 virtual void RegisterExtensionWithRequestContexts( | 91 virtual void RegisterExtensionWithRequestContexts( |
92 const Extension* extension) {} | 92 const extensions::Extension* extension) {} |
93 | 93 |
94 // Called by the ExtensionService that lives in this system. Lets the | 94 // Called by the ExtensionService that lives in this system. Lets the |
95 // info map clean up its RequestContexts once all the listeners to the | 95 // info map clean up its RequestContexts once all the listeners to the |
96 // EXTENSION_UNLOADED notification have finished running. | 96 // EXTENSION_UNLOADED notification have finished running. |
97 virtual void UnregisterExtensionWithRequestContexts( | 97 virtual void UnregisterExtensionWithRequestContexts( |
98 const std::string& extension_id, | 98 const std::string& extension_id, |
99 const extension_misc::UnloadedExtensionReason reason) {} | 99 const extension_misc::UnloadedExtensionReason reason) {} |
100 }; | 100 }; |
101 | 101 |
102 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. | 102 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. |
(...skipping 19 matching lines...) Expand all Loading... |
122 virtual extensions::LazyBackgroundTaskQueue* lazy_background_task_queue() | 122 virtual extensions::LazyBackgroundTaskQueue* lazy_background_task_queue() |
123 OVERRIDE; // shared | 123 OVERRIDE; // shared |
124 virtual ExtensionInfoMap* info_map() OVERRIDE; // shared | 124 virtual ExtensionInfoMap* info_map() OVERRIDE; // shared |
125 virtual ExtensionMessageService* message_service() OVERRIDE; // shared | 125 virtual ExtensionMessageService* message_service() OVERRIDE; // shared |
126 virtual ExtensionEventRouter* event_router() OVERRIDE; // shared | 126 virtual ExtensionEventRouter* event_router() OVERRIDE; // shared |
127 // The RulesRegistryService is created at startup. | 127 // The RulesRegistryService is created at startup. |
128 virtual extensions::RulesRegistryService* rules_registry_service() | 128 virtual extensions::RulesRegistryService* rules_registry_service() |
129 OVERRIDE; // shared | 129 OVERRIDE; // shared |
130 | 130 |
131 virtual void RegisterExtensionWithRequestContexts( | 131 virtual void RegisterExtensionWithRequestContexts( |
132 const Extension* extension) OVERRIDE; | 132 const extensions::Extension* extension) OVERRIDE; |
133 | 133 |
134 virtual void UnregisterExtensionWithRequestContexts( | 134 virtual void UnregisterExtensionWithRequestContexts( |
135 const std::string& extension_id, | 135 const std::string& extension_id, |
136 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; | 136 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; |
137 | 137 |
138 private: | 138 private: |
139 friend class ExtensionSystemSharedFactory; | 139 friend class ExtensionSystemSharedFactory; |
140 | 140 |
141 // Owns the Extension-related systems that have a single instance | 141 // Owns the Extension-related systems that have a single instance |
142 // shared between normal and incognito profiles. | 142 // shared between normal and incognito profiles. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // |io_data_|. While |extension_process_manager_| still lives, we handle | 188 // |io_data_|. While |extension_process_manager_| still lives, we handle |
189 // incoming resource requests from extension processes and those require | 189 // incoming resource requests from extension processes and those require |
190 // access to the ResourceContext owned by |io_data_|. | 190 // access to the ResourceContext owned by |io_data_|. |
191 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | 191 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
192 scoped_ptr<extensions::AlarmManager> alarm_manager_; | 192 scoped_ptr<extensions::AlarmManager> alarm_manager_; |
193 | 193 |
194 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 194 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
195 }; | 195 }; |
196 | 196 |
197 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ | 197 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ |
OLD | NEW |