| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/preference/preference_api.h" | 5 #include "chrome/browser/extensions/api/preference/preference_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 ExtensionPrefs* prefs, | 419 ExtensionPrefs* prefs, |
| 420 ExtensionPrefValueMap* value_map, | 420 ExtensionPrefValueMap* value_map, |
| 421 const std::string& extension_id, | 421 const std::string& extension_id, |
| 422 ExtensionPrefsScope scope) { | 422 ExtensionPrefsScope scope) { |
| 423 std::string scope_string; | 423 std::string scope_string; |
| 424 if (!pref_names::ScopeToPrefName(scope, &scope_string)) | 424 if (!pref_names::ScopeToPrefName(scope, &scope_string)) |
| 425 return; | 425 return; |
| 426 std::string key = extension_id + "." + scope_string; | 426 std::string key = extension_id + "." + scope_string; |
| 427 | 427 |
| 428 const base::DictionaryValue* source_dict = prefs->pref_service()-> | 428 const base::DictionaryValue* source_dict = prefs->pref_service()-> |
| 429 GetDictionary(prefs::kExtensionsPref); | 429 GetDictionary(pref_names::kExtensions); |
| 430 const base::DictionaryValue* preferences = NULL; | 430 const base::DictionaryValue* preferences = NULL; |
| 431 if (!source_dict->GetDictionary(key, &preferences)) | 431 if (!source_dict->GetDictionary(key, &preferences)) |
| 432 return; | 432 return; |
| 433 | 433 |
| 434 for (base::DictionaryValue::Iterator iter(*preferences); | 434 for (base::DictionaryValue::Iterator iter(*preferences); |
| 435 !iter.IsAtEnd(); iter.Advance()) { | 435 !iter.IsAtEnd(); iter.Advance()) { |
| 436 value_map->SetExtensionPref( | 436 value_map->SetExtensionPref( |
| 437 extension_id, iter.key(), scope, iter.value().DeepCopy()); | 437 extension_id, iter.key(), scope, iter.value().DeepCopy()); |
| 438 } | 438 } |
| 439 } | 439 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 std::string browser_pref; | 729 std::string browser_pref; |
| 730 if (!ValidateBrowserPref(pref_key, &browser_pref)) | 730 if (!ValidateBrowserPref(pref_key, &browser_pref)) |
| 731 return false; | 731 return false; |
| 732 | 732 |
| 733 PreferenceAPI::Get(GetProfile()) | 733 PreferenceAPI::Get(GetProfile()) |
| 734 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 734 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
| 735 return true; | 735 return true; |
| 736 } | 736 } |
| 737 | 737 |
| 738 } // namespace extensions | 738 } // namespace extensions |
| OLD | NEW |