| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); | 325 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); |
| 326 } else { | 326 } else { |
| 327 value_as_t = static_cast<T*>(key_value); | 327 value_as_t = static_cast<T*>(key_value); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 return value_as_t; | 330 return value_as_t; |
| 331 } | 331 } |
| 332 | 332 |
| 333 // Explicit instantiations for Dictionary and List value types. | 333 // Explicit instantiations for Dictionary and List value types. |
| 334 template class ExtensionPrefs::ScopedUpdate<base::DictionaryValue, | 334 template class ExtensionPrefs::ScopedUpdate<base::DictionaryValue, |
| 335 base::Value::TYPE_DICTIONARY>; | 335 base::Value::Type::DICTIONARY>; |
| 336 template class ExtensionPrefs::ScopedUpdate<base::ListValue, | 336 template class ExtensionPrefs::ScopedUpdate<base::ListValue, |
| 337 base::Value::TYPE_LIST>; | 337 base::Value::Type::LIST>; |
| 338 | 338 |
| 339 // | 339 // |
| 340 // ExtensionPrefs | 340 // ExtensionPrefs |
| 341 // | 341 // |
| 342 | 342 |
| 343 // static | 343 // static |
| 344 ExtensionPrefs* ExtensionPrefs::Create( | 344 ExtensionPrefs* ExtensionPrefs::Create( |
| 345 content::BrowserContext* browser_context, | 345 content::BrowserContext* browser_context, |
| 346 PrefService* prefs, | 346 PrefService* prefs, |
| 347 const base::FilePath& root_dir, | 347 const base::FilePath& root_dir, |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 std::set<std::string> ExtensionPrefs::GetBlacklistedExtensions() const { | 811 std::set<std::string> ExtensionPrefs::GetBlacklistedExtensions() const { |
| 812 std::set<std::string> ids; | 812 std::set<std::string> ids; |
| 813 | 813 |
| 814 const base::DictionaryValue* extensions = | 814 const base::DictionaryValue* extensions = |
| 815 prefs_->GetDictionary(pref_names::kExtensions); | 815 prefs_->GetDictionary(pref_names::kExtensions); |
| 816 if (!extensions) | 816 if (!extensions) |
| 817 return ids; | 817 return ids; |
| 818 | 818 |
| 819 for (base::DictionaryValue::Iterator it(*extensions); | 819 for (base::DictionaryValue::Iterator it(*extensions); |
| 820 !it.IsAtEnd(); it.Advance()) { | 820 !it.IsAtEnd(); it.Advance()) { |
| 821 if (!it.value().IsType(base::Value::TYPE_DICTIONARY)) { | 821 if (!it.value().IsType(base::Value::Type::DICTIONARY)) { |
| 822 NOTREACHED() << "Invalid pref for extension " << it.key(); | 822 NOTREACHED() << "Invalid pref for extension " << it.key(); |
| 823 continue; | 823 continue; |
| 824 } | 824 } |
| 825 if (IsBlacklistBitSet( | 825 if (IsBlacklistBitSet( |
| 826 static_cast<const base::DictionaryValue*>(&it.value()))) { | 826 static_cast<const base::DictionaryValue*>(&it.value()))) { |
| 827 ids.insert(it.key()); | 827 ids.insert(it.key()); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 | 830 |
| 831 return ids; | 831 return ids; |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); | 1975 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); |
| 1976 | 1976 |
| 1977 extension_pref_value_map_->RegisterExtension( | 1977 extension_pref_value_map_->RegisterExtension( |
| 1978 extension_id, install_time, is_enabled, is_incognito_enabled); | 1978 extension_id, install_time, is_enabled, is_incognito_enabled); |
| 1979 | 1979 |
| 1980 for (auto& observer : observer_list_) | 1980 for (auto& observer : observer_list_) |
| 1981 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); | 1981 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 } // namespace extensions | 1984 } // namespace extensions |
| OLD | NEW |