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 <unordered_map> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
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/singleton.h" | 15 #include "base/memory/singleton.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
19 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
20 #include "components/prefs/pref_change_registrar.h" | 20 #include "components/prefs/pref_change_registrar.h" |
21 #include "extensions/browser/management_policy.h" | 21 #include "extensions/browser/management_policy.h" |
22 #include "extensions/common/extension_id.h" | 22 #include "extensions/common/extension_id.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const PermissionSet& perms) const; | 123 const PermissionSet& perms) const; |
124 | 124 |
125 // Returns true if |extension| meets the minimum required version set for it. | 125 // Returns true if |extension| meets the minimum required version set for it. |
126 // If there is no such requirement set for it, returns true as well. | 126 // If there is no such requirement set for it, returns true as well. |
127 // If false is returned and |required_version| is not null, the minimum | 127 // If false is returned and |required_version| is not null, the minimum |
128 // required version is returned. | 128 // required version is returned. |
129 bool CheckMinimumVersion(const Extension* extension, | 129 bool CheckMinimumVersion(const Extension* extension, |
130 std::string* required_version) const; | 130 std::string* required_version) const; |
131 | 131 |
132 private: | 132 private: |
133 typedef base::ScopedPtrHashMap<ExtensionId, | 133 using SettingsIdMap = |
134 std::unique_ptr<internal::IndividualSettings>> | 134 std::unordered_map<ExtensionId, |
135 SettingsIdMap; | 135 std::unique_ptr<internal::IndividualSettings>>; |
136 typedef base::ScopedPtrHashMap<std::string, | 136 using SettingsUpdateUrlMap = |
137 std::unique_ptr<internal::IndividualSettings>> | 137 std::unordered_map<std::string, |
138 SettingsUpdateUrlMap; | 138 std::unique_ptr<internal::IndividualSettings>>; |
139 friend class ExtensionManagementServiceTest; | 139 friend class ExtensionManagementServiceTest; |
140 | 140 |
141 // Load all extension management preferences from |pref_service|, and | 141 // Load all extension management preferences from |pref_service|, and |
142 // refresh the settings. | 142 // refresh the settings. |
143 void Refresh(); | 143 void Refresh(); |
144 | 144 |
145 // Load preference with name |pref_name| and expected type |expected_type|. | 145 // Load preference with name |pref_name| and expected type |expected_type|. |
146 // If |force_managed| is true, only loading from the managed preference store | 146 // If |force_managed| is true, only loading from the managed preference store |
147 // is allowed. Returns NULL if the preference is not present, not allowed to | 147 // is allowed. Returns NULL if the preference is not present, not allowed to |
148 // be loaded from or has the wrong type. | 148 // be loaded from or has the wrong type. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |