| 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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { | 1808 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { |
| 1809 bool has_incognito_pref_value = false; | 1809 bool has_incognito_pref_value = false; |
| 1810 extension_pref_value_map_->GetEffectivePrefValue(pref_key, | 1810 extension_pref_value_map_->GetEffectivePrefValue(pref_key, |
| 1811 true, | 1811 true, |
| 1812 &has_incognito_pref_value); | 1812 &has_incognito_pref_value); |
| 1813 return has_incognito_pref_value; | 1813 return has_incognito_pref_value; |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 URLPatternSet ExtensionPrefs::GetAllowedInstallSites() { | |
| 1817 URLPatternSet result; | |
| 1818 const base::ListValue* list = | |
| 1819 prefs_->GetList(pref_names::kAllowedInstallSites); | |
| 1820 CHECK(list); | |
| 1821 | |
| 1822 for (size_t i = 0; i < list->GetSize(); ++i) { | |
| 1823 std::string entry_string; | |
| 1824 URLPattern entry(URLPattern::SCHEME_ALL); | |
| 1825 if (!list->GetString(i, &entry_string) || | |
| 1826 entry.Parse(entry_string) != URLPattern::PARSE_SUCCESS) { | |
| 1827 LOG(ERROR) << "Invalid value for preference: " | |
| 1828 << pref_names::kAllowedInstallSites << "." << i; | |
| 1829 continue; | |
| 1830 } | |
| 1831 result.AddPattern(entry); | |
| 1832 } | |
| 1833 | |
| 1834 return result; | |
| 1835 } | |
| 1836 | |
| 1837 const base::DictionaryValue* ExtensionPrefs::GetGeometryCache( | 1816 const base::DictionaryValue* ExtensionPrefs::GetGeometryCache( |
| 1838 const std::string& extension_id) const { | 1817 const std::string& extension_id) const { |
| 1839 const base::DictionaryValue* extension_prefs = GetExtensionPref(extension_id); | 1818 const base::DictionaryValue* extension_prefs = GetExtensionPref(extension_id); |
| 1840 if (!extension_prefs) | 1819 if (!extension_prefs) |
| 1841 return NULL; | 1820 return NULL; |
| 1842 | 1821 |
| 1843 const base::DictionaryValue* ext = NULL; | 1822 const base::DictionaryValue* ext = NULL; |
| 1844 if (!extension_prefs->GetDictionary(kPrefGeometryCache, &ext)) | 1823 if (!extension_prefs->GetDictionary(kPrefGeometryCache, &ext)) |
| 1845 return NULL; | 1824 return NULL; |
| 1846 | 1825 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2180 extension_pref_value_map_->RegisterExtension( | 2159 extension_pref_value_map_->RegisterExtension( |
| 2181 extension_id, install_time, is_enabled, is_incognito_enabled); | 2160 extension_id, install_time, is_enabled, is_incognito_enabled); |
| 2182 | 2161 |
| 2183 FOR_EACH_OBSERVER( | 2162 FOR_EACH_OBSERVER( |
| 2184 ExtensionPrefsObserver, | 2163 ExtensionPrefsObserver, |
| 2185 observer_list_, | 2164 observer_list_, |
| 2186 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2165 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
| 2187 } | 2166 } |
| 2188 | 2167 |
| 2189 } // namespace extensions | 2168 } // namespace extensions |
| OLD | NEW |