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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
12 #include "extensions/browser/extension_system.h" | 14 #include "extensions/browser/extension_system.h" |
13 #include "extensions/common/one_shot_event.h" | 15 #include "extensions/common/one_shot_event.h" |
14 | 16 |
15 class Profile; | 17 class Profile; |
16 | 18 |
17 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
18 namespace chromeos { | 20 namespace chromeos { |
19 class DeviceLocalAccountManagementPolicyProvider; | 21 class DeviceLocalAccountManagementPolicyProvider; |
20 class SigninScreenPolicyProvider; | 22 class SigninScreenPolicyProvider; |
21 } | 23 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 std::unique_ptr<ExtensionSet> GetDependentExtensions( | 73 std::unique_ptr<ExtensionSet> GetDependentExtensions( |
72 const Extension* extension) override; | 74 const Extension* extension) override; |
73 void InstallUpdate(const std::string& extension_id, | 75 void InstallUpdate(const std::string& extension_id, |
74 const base::FilePath& temp_dir) override; | 76 const base::FilePath& temp_dir) override; |
75 | 77 |
76 private: | 78 private: |
77 friend class ExtensionSystemSharedFactory; | 79 friend class ExtensionSystemSharedFactory; |
78 | 80 |
79 // Owns the Extension-related systems that have a single instance | 81 // Owns the Extension-related systems that have a single instance |
80 // shared between normal and incognito profiles. | 82 // shared between normal and incognito profiles. |
81 class Shared : public KeyedService { | 83 class Shared : public KeyedService, public content::NotificationObserver { |
82 public: | 84 public: |
83 explicit Shared(Profile* profile); | 85 explicit Shared(Profile* profile); |
84 ~Shared() override; | 86 ~Shared() override; |
85 | 87 |
86 // Initialization takes place in phases. | 88 // Initialization takes place in phases. |
87 virtual void InitPrefs(); | 89 virtual void InitPrefs(); |
88 // This must not be called until all the providers have been created. | 90 // This must not be called until all the providers have been created. |
89 void RegisterManagementPolicyProviders(); | 91 void RegisterManagementPolicyProviders(); |
90 void InitInstallGates(); | 92 void InitInstallGates(); |
91 void Init(bool extensions_enabled); | 93 void Init(bool extensions_enabled); |
92 | 94 |
93 // KeyedService implementation. | 95 // KeyedService implementation. |
94 void Shutdown() override; | 96 void Shutdown() override; |
95 | 97 |
96 StateStore* state_store(); | 98 StateStore* state_store(); |
97 StateStore* rules_store(); | 99 StateStore* rules_store(); |
98 scoped_refptr<ValueStoreFactory> store_factory() const; | 100 scoped_refptr<ValueStoreFactory> store_factory() const; |
99 ExtensionService* extension_service(); | 101 ExtensionService* extension_service(); |
100 RuntimeData* runtime_data(); | 102 RuntimeData* runtime_data(); |
101 ManagementPolicy* management_policy(); | 103 ManagementPolicy* management_policy(); |
102 ServiceWorkerManager* service_worker_manager(); | 104 ServiceWorkerManager* service_worker_manager(); |
103 SharedUserScriptMaster* shared_user_script_master(); | 105 SharedUserScriptMaster* shared_user_script_master(); |
104 InfoMap* info_map(); | 106 InfoMap* info_map(); |
105 QuotaService* quota_service(); | 107 QuotaService* quota_service(); |
106 AppSorting* app_sorting(); | 108 AppSorting* app_sorting(); |
107 const OneShotEvent& ready() const { return ready_; } | 109 const OneShotEvent& ready() const { return ready_; } |
108 ContentVerifier* content_verifier(); | 110 ContentVerifier* content_verifier(); |
109 | 111 |
110 private: | 112 private: |
| 113 // content::NotificationObserver implementation. |
| 114 void Observe(int type, |
| 115 const content::NotificationSource& source, |
| 116 const content::NotificationDetails& details) override; |
| 117 |
111 Profile* profile_; | 118 Profile* profile_; |
112 | 119 |
113 // The services that are shared between normal and incognito profiles. | 120 // The services that are shared between normal and incognito profiles. |
114 | 121 |
| 122 content::NotificationRegistrar registrar_; |
115 std::unique_ptr<StateStore> state_store_; | 123 std::unique_ptr<StateStore> state_store_; |
116 std::unique_ptr<StateStoreNotificationObserver> | 124 std::unique_ptr<StateStoreNotificationObserver> |
117 state_store_notification_observer_; | 125 state_store_notification_observer_; |
118 std::unique_ptr<StateStore> rules_store_; | 126 std::unique_ptr<StateStore> rules_store_; |
119 scoped_refptr<ValueStoreFactoryImpl> store_factory_; | 127 scoped_refptr<ValueStoreFactoryImpl> store_factory_; |
120 std::unique_ptr<NavigationObserver> navigation_observer_; | 128 std::unique_ptr<NavigationObserver> navigation_observer_; |
121 std::unique_ptr<ServiceWorkerManager> service_worker_manager_; | 129 std::unique_ptr<ServiceWorkerManager> service_worker_manager_; |
122 // Shared memory region manager for scripts statically declared in extension | 130 // Shared memory region manager for scripts statically declared in extension |
123 // manifests. This region is shared between all extensions. | 131 // manifests. This region is shared between all extensions. |
124 std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_; | 132 std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_; |
(...skipping 26 matching lines...) Expand all Loading... |
151 Profile* profile_; | 159 Profile* profile_; |
152 | 160 |
153 Shared* shared_; | 161 Shared* shared_; |
154 | 162 |
155 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); | 163 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); |
156 }; | 164 }; |
157 | 165 |
158 } // namespace extensions | 166 } // namespace extensions |
159 | 167 |
160 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ | 168 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_ |
OLD | NEW |