OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 DCHECK(!FilePath(path_string).IsAbsolute()); | 233 DCHECK(!FilePath(path_string).IsAbsolute()); |
234 extension_dict->SetString( | 234 extension_dict->SetString( |
235 kPrefPath, install_directory_.Append(path_string).value()); | 235 kPrefPath, install_directory_.Append(path_string).value()); |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 DictionaryValue* ExtensionPrefs::CopyCurrentExtensions() { | 239 DictionaryValue* ExtensionPrefs::CopyCurrentExtensions() { |
240 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); | 240 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); |
241 if (extensions) { | 241 if (extensions) { |
242 DictionaryValue* copy = | 242 DictionaryValue* copy = extensions->DeepCopy(); |
243 static_cast<DictionaryValue*>(extensions->DeepCopy()); | |
244 MakePathsAbsolute(copy); | 243 MakePathsAbsolute(copy); |
245 return copy; | 244 return copy; |
246 } | 245 } |
247 return new DictionaryValue; | 246 return new DictionaryValue; |
248 } | 247 } |
249 | 248 |
250 bool ExtensionPrefs::ReadBooleanFromPref( | 249 bool ExtensionPrefs::ReadBooleanFromPref( |
251 DictionaryValue* ext, const std::string& pref_key) { | 250 DictionaryValue* ext, const std::string& pref_key) { |
252 bool bool_value = false; | 251 bool bool_value = false; |
253 if (!ext->GetBoolean(pref_key, &bool_value)) | 252 if (!ext->GetBoolean(pref_key, &bool_value)) |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 1300 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
1302 prefs->RegisterDictionaryPref(kExtensionsPref); | 1301 prefs->RegisterDictionaryPref(kExtensionsPref); |
1303 prefs->RegisterListPref(kExtensionToolbar); | 1302 prefs->RegisterListPref(kExtensionToolbar); |
1304 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 1303 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
1305 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 1304 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
1306 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 1305 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
1307 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 1306 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
1308 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 1307 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
1309 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 1308 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
1310 } | 1309 } |
OLD | NEW |