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 #include "extensions/browser/extension_prefs.h" | 5 #include "extensions/browser/extension_prefs.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_notifier.h" | 10 #include "base/prefs/pref_notifier.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 const char kCorruptedDisableCount[] = "extensions.corrupted_disable_count"; | 194 const char kCorruptedDisableCount[] = "extensions.corrupted_disable_count"; |
195 | 195 |
196 // Provider of write access to a dictionary storing extension prefs. | 196 // Provider of write access to a dictionary storing extension prefs. |
197 class ScopedExtensionPrefUpdate : public DictionaryPrefUpdate { | 197 class ScopedExtensionPrefUpdate : public DictionaryPrefUpdate { |
198 public: | 198 public: |
199 ScopedExtensionPrefUpdate(PrefService* service, | 199 ScopedExtensionPrefUpdate(PrefService* service, |
200 const std::string& extension_id) : | 200 const std::string& extension_id) : |
201 DictionaryPrefUpdate(service, pref_names::kExtensions), | 201 DictionaryPrefUpdate(service, pref_names::kExtensions), |
202 extension_id_(extension_id) {} | 202 extension_id_(extension_id) {} |
203 | 203 |
204 virtual ~ScopedExtensionPrefUpdate() { | 204 ~ScopedExtensionPrefUpdate() override {} |
205 } | |
206 | 205 |
207 // DictionaryPrefUpdate overrides: | 206 // DictionaryPrefUpdate overrides: |
208 virtual base::DictionaryValue* Get() override { | 207 base::DictionaryValue* Get() override { |
209 base::DictionaryValue* dict = DictionaryPrefUpdate::Get(); | 208 base::DictionaryValue* dict = DictionaryPrefUpdate::Get(); |
210 base::DictionaryValue* extension = NULL; | 209 base::DictionaryValue* extension = NULL; |
211 if (!dict->GetDictionary(extension_id_, &extension)) { | 210 if (!dict->GetDictionary(extension_id_, &extension)) { |
212 // Extension pref does not exist, create it. | 211 // Extension pref does not exist, create it. |
213 extension = new base::DictionaryValue(); | 212 extension = new base::DictionaryValue(); |
214 dict->SetWithoutPathExpansion(extension_id_, extension); | 213 dict->SetWithoutPathExpansion(extension_id_, extension); |
215 } | 214 } |
216 return extension; | 215 return extension; |
217 } | 216 } |
218 | 217 |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 extension_pref_value_map_->RegisterExtension( | 2101 extension_pref_value_map_->RegisterExtension( |
2103 extension_id, install_time, is_enabled, is_incognito_enabled); | 2102 extension_id, install_time, is_enabled, is_incognito_enabled); |
2104 | 2103 |
2105 FOR_EACH_OBSERVER( | 2104 FOR_EACH_OBSERVER( |
2106 ExtensionPrefsObserver, | 2105 ExtensionPrefsObserver, |
2107 observer_list_, | 2106 observer_list_, |
2108 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2107 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2109 } | 2108 } |
2110 | 2109 |
2111 } // namespace extensions | 2110 } // namespace extensions |
OLD | NEW |