| 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/prefs/pref_service.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/prefs/pref_model_associator.h" | 28 #include "chrome/browser/prefs/pref_model_associator.h" |
| 29 #include "chrome/browser/prefs/pref_notifier_impl.h" | 29 #include "chrome/browser/prefs/pref_notifier_impl.h" |
| 30 #include "chrome/browser/prefs/pref_value_store.h" | 30 #include "chrome/browser/prefs/pref_value_store.h" |
| 31 #include "chrome/browser/ui/profile_error_dialog.h" | 31 #include "chrome/browser/ui/profile_error_dialog.h" |
| 32 #include "chrome/common/json_pref_store.h" | 32 #include "chrome/common/json_pref_store.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
| 35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 | 37 |
| 38 using content::BrowserThread; |
| 39 |
| 38 namespace { | 40 namespace { |
| 39 | 41 |
| 40 // A helper function for RegisterLocalized*Pref that creates a Value* based on | 42 // A helper function for RegisterLocalized*Pref that creates a Value* based on |
| 41 // the string value in the locale dll. Because we control the values in a | 43 // the string value in the locale dll. Because we control the values in a |
| 42 // locale dll, this should always return a Value of the appropriate type. | 44 // locale dll, this should always return a Value of the appropriate type. |
| 43 Value* CreateLocaleDefaultValue(base::Value::Type type, int message_id) { | 45 Value* CreateLocaleDefaultValue(base::Value::Type type, int message_id) { |
| 44 std::string resource_string = l10n_util::GetStringUTF8(message_id); | 46 std::string resource_string = l10n_util::GetStringUTF8(message_id); |
| 45 DCHECK(!resource_string.empty()); | 47 DCHECK(!resource_string.empty()); |
| 46 switch (type) { | 48 switch (type) { |
| 47 case Value::TYPE_BOOLEAN: { | 49 case Value::TYPE_BOOLEAN: { |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 897 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
| 896 } | 898 } |
| 897 | 899 |
| 898 bool PrefService::Preference::IsUserModifiable() const { | 900 bool PrefService::Preference::IsUserModifiable() const { |
| 899 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 901 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
| 900 } | 902 } |
| 901 | 903 |
| 902 bool PrefService::Preference::IsExtensionModifiable() const { | 904 bool PrefService::Preference::IsExtensionModifiable() const { |
| 903 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 905 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
| 904 } | 906 } |
| OLD | NEW |