OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ |
7 | 7 |
8 #include "extensions/browser/extension_system.h" | 8 #include "extensions/browser/extension_system.h" |
9 #include "extensions/common/one_shot_event.h" | 9 #include "extensions/common/one_shot_event.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 class ContentVerifier; | 15 class ContentVerifier; |
16 class DeclarativeUserScriptMaster; | |
16 class ExtensionSystemSharedFactory; | 17 class ExtensionSystemSharedFactory; |
17 class ExtensionWarningBadgeService; | 18 class ExtensionWarningBadgeService; |
18 class NavigationObserver; | 19 class NavigationObserver; |
20 class SharedUserScriptMaster; | |
19 class StandardManagementPolicyProvider; | 21 class StandardManagementPolicyProvider; |
20 class StateStoreNotificationObserver; | 22 class StateStoreNotificationObserver; |
23 class UserScriptMasterManager; | |
21 | 24 |
22 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. | 25 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. |
23 // Implementation details: non-shared services are owned by | 26 // Implementation details: non-shared services are owned by |
24 // ExtensionSystemImpl, a KeyedService with separate incognito | 27 // ExtensionSystemImpl, a KeyedService with separate incognito |
25 // instances. A private Shared class (also a KeyedService, | 28 // instances. A private Shared class (also a KeyedService, |
26 // but with a shared instance for incognito) keeps the common services. | 29 // but with a shared instance for incognito) keeps the common services. |
27 class ExtensionSystemImpl : public ExtensionSystem { | 30 class ExtensionSystemImpl : public ExtensionSystem { |
28 public: | 31 public: |
29 explicit ExtensionSystemImpl(Profile* profile); | 32 explicit ExtensionSystemImpl(Profile* profile); |
30 virtual ~ExtensionSystemImpl(); | 33 virtual ~ExtensionSystemImpl(); |
31 | 34 |
32 // KeyedService implementation. | 35 // KeyedService implementation. |
33 virtual void Shutdown() OVERRIDE; | 36 virtual void Shutdown() OVERRIDE; |
34 | 37 |
35 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; | 38 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; |
36 | 39 |
37 virtual ExtensionService* extension_service() OVERRIDE; // shared | 40 virtual ExtensionService* extension_service() OVERRIDE; // shared |
38 virtual RuntimeData* runtime_data() OVERRIDE; // shared | 41 virtual RuntimeData* runtime_data() OVERRIDE; // shared |
39 virtual ManagementPolicy* management_policy() OVERRIDE; // shared | 42 virtual ManagementPolicy* management_policy() OVERRIDE; // shared |
40 virtual UserScriptMaster* user_script_master() OVERRIDE; // shared | 43 virtual SharedUserScriptMaster* shared_user_script_master() OVERRIDE; |
44 // ^--- shared | |
Devlin
2014/08/04 18:33:24
Let's just move this above the sharedUserScriptMas
Mark Dittmer
2014/08/05 20:33:18
Done.
| |
41 virtual ProcessManager* process_manager() OVERRIDE; | 45 virtual ProcessManager* process_manager() OVERRIDE; |
42 virtual StateStore* state_store() OVERRIDE; // shared | 46 virtual StateStore* state_store() OVERRIDE; // shared |
43 virtual StateStore* rules_store() OVERRIDE; // shared | 47 virtual StateStore* rules_store() OVERRIDE; // shared |
44 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() | 48 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() |
45 OVERRIDE; // shared | 49 OVERRIDE; // shared |
46 virtual InfoMap* info_map() OVERRIDE; // shared | 50 virtual InfoMap* info_map() OVERRIDE; // shared |
47 virtual EventRouter* event_router() OVERRIDE; // shared | 51 virtual EventRouter* event_router() OVERRIDE; // shared |
48 virtual ExtensionWarningService* warning_service() OVERRIDE; | 52 virtual ExtensionWarningService* warning_service() OVERRIDE; |
49 virtual Blacklist* blacklist() OVERRIDE; // shared | 53 virtual Blacklist* blacklist() OVERRIDE; // shared |
50 virtual ErrorConsole* error_console() OVERRIDE; | 54 virtual ErrorConsole* error_console() OVERRIDE; |
51 virtual InstallVerifier* install_verifier() OVERRIDE; | 55 virtual InstallVerifier* install_verifier() OVERRIDE; |
52 virtual QuotaService* quota_service() OVERRIDE; // shared | 56 virtual QuotaService* quota_service() OVERRIDE; // shared |
53 | 57 |
54 virtual void RegisterExtensionWithRequestContexts( | 58 virtual void RegisterExtensionWithRequestContexts( |
55 const Extension* extension) OVERRIDE; | 59 const Extension* extension) OVERRIDE; |
56 | 60 |
57 virtual void UnregisterExtensionWithRequestContexts( | 61 virtual void UnregisterExtensionWithRequestContexts( |
58 const std::string& extension_id, | 62 const std::string& extension_id, |
59 const UnloadedExtensionInfo::Reason reason) OVERRIDE; | 63 const UnloadedExtensionInfo::Reason reason) OVERRIDE; |
60 | 64 |
61 virtual const OneShotEvent& ready() const OVERRIDE; | 65 virtual const OneShotEvent& ready() const OVERRIDE; |
62 virtual ContentVerifier* content_verifier() OVERRIDE; // shared | 66 virtual ContentVerifier* content_verifier() OVERRIDE; // shared |
63 virtual scoped_ptr<ExtensionSet> GetDependentExtensions( | 67 virtual scoped_ptr<ExtensionSet> GetDependentExtensions( |
64 const Extension* extension) OVERRIDE; | 68 const Extension* extension) OVERRIDE; |
65 | 69 |
70 virtual DeclarativeUserScriptMaster* | |
71 GetDeclarativeUserScriptMasterByExtension( | |
72 const ExtensionId& extension_id) OVERRIDE; | |
73 | |
66 private: | 74 private: |
67 friend class ExtensionSystemSharedFactory; | 75 friend class ExtensionSystemSharedFactory; |
68 | 76 |
69 // Owns the Extension-related systems that have a single instance | 77 // Owns the Extension-related systems that have a single instance |
70 // shared between normal and incognito profiles. | 78 // shared between normal and incognito profiles. |
71 class Shared : public KeyedService { | 79 class Shared : public KeyedService { |
72 public: | 80 public: |
73 explicit Shared(Profile* profile); | 81 explicit Shared(Profile* profile); |
74 virtual ~Shared(); | 82 virtual ~Shared(); |
75 | 83 |
76 // Initialization takes place in phases. | 84 // Initialization takes place in phases. |
77 virtual void InitPrefs(); | 85 virtual void InitPrefs(); |
78 // This must not be called until all the providers have been created. | 86 // This must not be called until all the providers have been created. |
79 void RegisterManagementPolicyProviders(); | 87 void RegisterManagementPolicyProviders(); |
80 void Init(bool extensions_enabled); | 88 void Init(bool extensions_enabled); |
81 | 89 |
82 // KeyedService implementation. | 90 // KeyedService implementation. |
83 virtual void Shutdown() OVERRIDE; | 91 virtual void Shutdown() OVERRIDE; |
84 | 92 |
85 StateStore* state_store(); | 93 StateStore* state_store(); |
86 StateStore* rules_store(); | 94 StateStore* rules_store(); |
87 ExtensionService* extension_service(); | 95 ExtensionService* extension_service(); |
88 RuntimeData* runtime_data(); | 96 RuntimeData* runtime_data(); |
89 ManagementPolicy* management_policy(); | 97 ManagementPolicy* management_policy(); |
90 UserScriptMaster* user_script_master(); | 98 SharedUserScriptMaster* shared_user_script_master(); |
91 Blacklist* blacklist(); | 99 Blacklist* blacklist(); |
92 InfoMap* info_map(); | 100 InfoMap* info_map(); |
93 LazyBackgroundTaskQueue* lazy_background_task_queue(); | 101 LazyBackgroundTaskQueue* lazy_background_task_queue(); |
94 EventRouter* event_router(); | 102 EventRouter* event_router(); |
95 ExtensionWarningService* warning_service(); | 103 ExtensionWarningService* warning_service(); |
96 ErrorConsole* error_console(); | 104 ErrorConsole* error_console(); |
97 InstallVerifier* install_verifier(); | 105 InstallVerifier* install_verifier(); |
98 QuotaService* quota_service(); | 106 QuotaService* quota_service(); |
99 const OneShotEvent& ready() const { return ready_; } | 107 const OneShotEvent& ready() const { return ready_; } |
100 ContentVerifier* content_verifier(); | 108 ContentVerifier* content_verifier(); |
101 | 109 |
110 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByExtension( | |
111 const ExtensionId& extension_id); | |
112 | |
102 private: | 113 private: |
103 Profile* profile_; | 114 Profile* profile_; |
104 | 115 |
105 // The services that are shared between normal and incognito profiles. | 116 // The services that are shared between normal and incognito profiles. |
106 | 117 |
107 scoped_ptr<StateStore> state_store_; | 118 scoped_ptr<StateStore> state_store_; |
108 scoped_ptr<StateStoreNotificationObserver> | 119 scoped_ptr<StateStoreNotificationObserver> |
109 state_store_notification_observer_; | 120 state_store_notification_observer_; |
110 scoped_ptr<StateStore> rules_store_; | 121 scoped_ptr<StateStore> rules_store_; |
111 // LazyBackgroundTaskQueue is a dependency of | 122 // LazyBackgroundTaskQueue is a dependency of |
112 // MessageService and EventRouter. | 123 // MessageService and EventRouter. |
113 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; | 124 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; |
114 scoped_ptr<EventRouter> event_router_; | 125 scoped_ptr<EventRouter> event_router_; |
115 scoped_ptr<NavigationObserver> navigation_observer_; | 126 scoped_ptr<NavigationObserver> navigation_observer_; |
116 scoped_ptr<UserScriptMaster> user_script_master_; | 127 scoped_ptr<UserScriptMasterManager> user_script_master_manager_; |
117 scoped_ptr<Blacklist> blacklist_; | 128 scoped_ptr<Blacklist> blacklist_; |
118 // StandardManagementPolicyProvider depends on Blacklist. | 129 // StandardManagementPolicyProvider depends on Blacklist. |
119 scoped_ptr<StandardManagementPolicyProvider> | 130 scoped_ptr<StandardManagementPolicyProvider> |
120 standard_management_policy_provider_; | 131 standard_management_policy_provider_; |
121 scoped_ptr<RuntimeData> runtime_data_; | 132 scoped_ptr<RuntimeData> runtime_data_; |
122 // ExtensionService depends on StateStore, Blacklist and RuntimeData. | 133 // ExtensionService depends on StateStore, Blacklist and RuntimeData. |
123 scoped_ptr<ExtensionService> extension_service_; | 134 scoped_ptr<ExtensionService> extension_service_; |
124 scoped_ptr<ManagementPolicy> management_policy_; | 135 scoped_ptr<ManagementPolicy> management_policy_; |
125 // extension_info_map_ needs to outlive process_manager_. | 136 // extension_info_map_ needs to outlive process_manager_. |
126 scoped_refptr<InfoMap> extension_info_map_; | 137 scoped_refptr<InfoMap> extension_info_map_; |
(...skipping 23 matching lines...) Expand all Loading... | |
150 // extension processes and those require access to the ResourceContext owned | 161 // extension processes and those require access to the ResourceContext owned |
151 // by |io_data_|. | 162 // by |io_data_|. |
152 scoped_ptr<ProcessManager> process_manager_; | 163 scoped_ptr<ProcessManager> process_manager_; |
153 | 164 |
154 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 165 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
155 }; | 166 }; |
156 | 167 |
157 } // namespace extensions | 168 } // namespace extensions |
158 | 169 |
159 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ | 170 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ |
OLD | NEW |