Chromium Code Reviews| 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_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 extension_pref_value_map_->NotifyInitializationCompleted(); | 1248 extension_pref_value_map_->NotifyInitializationCompleted(); |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 | 1251 |
| 1252 void ExtensionPrefs::SetExtensionControlledPref(const std::string& extension_id, | 1252 void ExtensionPrefs::SetExtensionControlledPref(const std::string& extension_id, |
| 1253 const std::string& pref_key, | 1253 const std::string& pref_key, |
| 1254 bool incognito, | 1254 bool incognito, |
| 1255 Value* value) { | 1255 Value* value) { |
| 1256 DCHECK(pref_service()->FindPreference(pref_key.c_str())) | 1256 #ifndef NDEBUG |
|
Aaron Boodman
2011/02/11 18:33:19
I think you should do this in all situations, not
Bernhard Bauer
2011/02/13 18:19:12
So, also make them into |CHECK|s? Ideally, we'd al
Aaron Boodman
2011/02/14 02:54:02
I see. Ok, I don't feel so strongly about this cas
| |
| 1257 << "Extension controlled preference key " << pref_key | 1257 const PrefService::Preference* pref = |
| 1258 << " not registered."; | 1258 pref_service()->FindPreference(pref_key.c_str()); |
| 1259 DCHECK(pref) << "Extension controlled preference key " << pref_key | |
| 1260 << " not registered."; | |
| 1261 DCHECK_EQ(pref->GetType(), value->GetType()) | |
| 1262 << "Extension controlled preference " << pref_key << " has wrong type."; | |
| 1263 #endif | |
| 1259 | 1264 |
| 1260 if (!incognito) { | 1265 if (!incognito) { |
| 1261 // Also store in persisted Preferences file to recover after a | 1266 // Also store in persisted Preferences file to recover after a |
| 1262 // browser restart. | 1267 // browser restart. |
| 1263 DictionaryValue* dict = GetExtensionControlledPrefs(extension_id); | 1268 DictionaryValue* dict = GetExtensionControlledPrefs(extension_id); |
| 1264 dict->SetWithoutPathExpansion(pref_key, value->DeepCopy()); | 1269 dict->SetWithoutPathExpansion(pref_key, value->DeepCopy()); |
| 1265 pref_service()->ScheduleSavePersistentPrefs(); | 1270 pref_service()->ScheduleSavePersistentPrefs(); |
| 1266 } | 1271 } |
| 1267 | 1272 |
| 1268 extension_pref_value_map_->SetExtensionPref( | 1273 extension_pref_value_map_->SetExtensionPref( |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1293 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 1298 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
| 1294 prefs->RegisterDictionaryPref(kExtensionsPref); | 1299 prefs->RegisterDictionaryPref(kExtensionsPref); |
| 1295 prefs->RegisterListPref(kExtensionToolbar); | 1300 prefs->RegisterListPref(kExtensionToolbar); |
| 1296 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 1301 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
| 1297 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 1302 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
| 1298 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 1303 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
| 1299 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 1304 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
| 1300 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 1305 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
| 1301 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 1306 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
| 1302 } | 1307 } |
| OLD | NEW |