OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_prefs.h" | 5 #include "chrome/browser/extensions/extension_prefs.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_pref_store.h" | 10 #include "chrome/browser/extensions/extension_pref_store.h" |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 *ext_id, | 1672 *ext_id, |
1673 GetInstallTime(*ext_id), | 1673 GetInstallTime(*ext_id), |
1674 !IsExtensionDisabled(*ext_id)); | 1674 !IsExtensionDisabled(*ext_id)); |
1675 content_settings_store_->RegisterExtension( | 1675 content_settings_store_->RegisterExtension( |
1676 *ext_id, | 1676 *ext_id, |
1677 GetInstallTime(*ext_id), | 1677 GetInstallTime(*ext_id), |
1678 !IsExtensionDisabled(*ext_id)); | 1678 !IsExtensionDisabled(*ext_id)); |
1679 | 1679 |
1680 // Set regular extension controlled prefs. | 1680 // Set regular extension controlled prefs. |
1681 const DictionaryValue* prefs = GetExtensionControlledPrefs(*ext_id, false); | 1681 const DictionaryValue* prefs = GetExtensionControlledPrefs(*ext_id, false); |
1682 for (DictionaryValue::key_iterator i = prefs->begin_keys(); | 1682 for (DictionaryValue::Iterator i(*prefs); i.HasNext(); i.Advance()) { |
1683 i != prefs->end_keys(); ++i) { | |
1684 Value* value; | |
1685 if (!prefs->GetWithoutPathExpansion(*i, &value)) | |
1686 continue; | |
1687 extension_pref_value_map_->SetExtensionPref( | 1683 extension_pref_value_map_->SetExtensionPref( |
1688 *ext_id, *i, kExtensionPrefsScopeRegular, value->DeepCopy()); | 1684 *ext_id, i.key(), kExtensionPrefsScopeRegular, i.value().DeepCopy()); |
1689 } | 1685 } |
1690 | 1686 |
1691 // Set incognito extension controlled prefs. | 1687 // Set incognito extension controlled prefs. |
1692 prefs = GetExtensionControlledPrefs(*ext_id, true); | 1688 prefs = GetExtensionControlledPrefs(*ext_id, true); |
1693 for (DictionaryValue::key_iterator i = prefs->begin_keys(); | 1689 for (DictionaryValue::Iterator i(*prefs); i.HasNext(); i.Advance()) { |
1694 i != prefs->end_keys(); ++i) { | |
1695 Value* value; | |
1696 if (!prefs->GetWithoutPathExpansion(*i, &value)) | |
1697 continue; | |
1698 extension_pref_value_map_->SetExtensionPref( | 1690 extension_pref_value_map_->SetExtensionPref( |
1699 *ext_id, *i, kExtensionPrefsScopeIncognitoPersistent, | 1691 *ext_id, i.key(), kExtensionPrefsScopeIncognitoPersistent, |
1700 value->DeepCopy()); | 1692 i.value().DeepCopy()); |
1701 } | 1693 } |
1702 | 1694 |
1703 // Set content settings. | 1695 // Set content settings. |
1704 const DictionaryValue* extension_prefs = GetExtensionPref(*ext_id); | 1696 const DictionaryValue* extension_prefs = GetExtensionPref(*ext_id); |
1705 DCHECK(extension_prefs); | 1697 DCHECK(extension_prefs); |
1706 ListValue* content_settings = NULL; | 1698 ListValue* content_settings = NULL; |
1707 if (extension_prefs->GetList(kPrefContentSettings, | 1699 if (extension_prefs->GetList(kPrefContentSettings, |
1708 &content_settings)) { | 1700 &content_settings)) { |
1709 content_settings_store_->SetExtensionContentSettingsFromList( | 1701 content_settings_store_->SetExtensionContentSettingsFromList( |
1710 *ext_id, content_settings, | 1702 *ext_id, content_settings, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1822 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1831 PrefService::UNSYNCABLE_PREF); | 1823 PrefService::UNSYNCABLE_PREF); |
1832 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1824 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1833 PrefService::UNSYNCABLE_PREF); | 1825 PrefService::UNSYNCABLE_PREF); |
1834 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1826 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1835 PrefService::UNSYNCABLE_PREF); | 1827 PrefService::UNSYNCABLE_PREF); |
1836 prefs->RegisterStringPref(kWebStoreLogin, | 1828 prefs->RegisterStringPref(kWebStoreLogin, |
1837 std::string() /* default_value */, | 1829 std::string() /* default_value */, |
1838 PrefService::UNSYNCABLE_PREF); | 1830 PrefService::UNSYNCABLE_PREF); |
1839 } | 1831 } |
OLD | NEW |