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_MANAGEMENT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/scoped_ptr_hash_map.h" | 12 #include "base/containers/scoped_ptr_hash_map.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_vector.h" | |
16 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
17 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
18 #include "base/values.h" | 17 #include "base/values.h" |
19 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
20 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
21 #include "components/prefs/pref_change_registrar.h" | 20 #include "components/prefs/pref_change_registrar.h" |
22 #include "extensions/browser/management_policy.h" | 21 #include "extensions/browser/management_policy.h" |
23 #include "extensions/common/extension_id.h" | 22 #include "extensions/common/extension_id.h" |
24 #include "extensions/common/manifest.h" | 23 #include "extensions/common/manifest.h" |
25 | 24 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ~ExtensionManagement() override; | 74 ~ExtensionManagement() override; |
76 | 75 |
77 // KeyedService implementations: | 76 // KeyedService implementations: |
78 void Shutdown() override; | 77 void Shutdown() override; |
79 | 78 |
80 void AddObserver(Observer* observer); | 79 void AddObserver(Observer* observer); |
81 void RemoveObserver(Observer* observer); | 80 void RemoveObserver(Observer* observer); |
82 | 81 |
83 // Get the list of ManagementPolicy::Provider controlled by extension | 82 // Get the list of ManagementPolicy::Provider controlled by extension |
84 // management policy settings. | 83 // management policy settings. |
85 std::vector<ManagementPolicy::Provider*> GetProviders() const; | 84 const std::vector<std::unique_ptr<ManagementPolicy::Provider>>& GetProviders() |
| 85 const; |
86 | 86 |
87 // Checks if extensions are blacklisted by default, by policy. When true, | 87 // Checks if extensions are blacklisted by default, by policy. When true, |
88 // this means that even extensions without an ID should be blacklisted (e.g. | 88 // this means that even extensions without an ID should be blacklisted (e.g. |
89 // from the command line, or when loaded as an unpacked extension). | 89 // from the command line, or when loaded as an unpacked extension). |
90 bool BlacklistedByDefault() const; | 90 bool BlacklistedByDefault() const; |
91 | 91 |
92 // Returns installation mode for an extension. | 92 // Returns installation mode for an extension. |
93 InstallationMode GetInstallationMode(const Extension* extension) const; | 93 InstallationMode GetInstallationMode(const Extension* extension) const; |
94 | 94 |
95 // Returns the force install list, in format specified by | 95 // Returns the force install list, in format specified by |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // enforced. | 180 // enforced. |
181 std::unique_ptr<internal::IndividualSettings> default_settings_; | 181 std::unique_ptr<internal::IndividualSettings> default_settings_; |
182 | 182 |
183 // Extension settings applicable to all extensions. | 183 // Extension settings applicable to all extensions. |
184 std::unique_ptr<internal::GlobalSettings> global_settings_; | 184 std::unique_ptr<internal::GlobalSettings> global_settings_; |
185 | 185 |
186 PrefService* pref_service_; | 186 PrefService* pref_service_; |
187 | 187 |
188 base::ObserverList<Observer, true> observer_list_; | 188 base::ObserverList<Observer, true> observer_list_; |
189 PrefChangeRegistrar pref_change_registrar_; | 189 PrefChangeRegistrar pref_change_registrar_; |
190 ScopedVector<ManagementPolicy::Provider> providers_; | 190 std::vector<std::unique_ptr<ManagementPolicy::Provider>> providers_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(ExtensionManagement); | 192 DISALLOW_COPY_AND_ASSIGN(ExtensionManagement); |
193 }; | 193 }; |
194 | 194 |
195 class ExtensionManagementFactory : public BrowserContextKeyedServiceFactory { | 195 class ExtensionManagementFactory : public BrowserContextKeyedServiceFactory { |
196 public: | 196 public: |
197 static ExtensionManagement* GetForBrowserContext( | 197 static ExtensionManagement* GetForBrowserContext( |
198 content::BrowserContext* context); | 198 content::BrowserContext* context); |
199 static ExtensionManagementFactory* GetInstance(); | 199 static ExtensionManagementFactory* GetInstance(); |
200 | 200 |
(...skipping 10 matching lines...) Expand all Loading... |
211 content::BrowserContext* context) const override; | 211 content::BrowserContext* context) const override; |
212 void RegisterProfilePrefs( | 212 void RegisterProfilePrefs( |
213 user_prefs::PrefRegistrySyncable* registry) override; | 213 user_prefs::PrefRegistrySyncable* registry) override; |
214 | 214 |
215 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); | 215 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); |
216 }; | 216 }; |
217 | 217 |
218 } // namespace extensions | 218 } // namespace extensions |
219 | 219 |
220 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 220 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
OLD | NEW |