Index: base/prefs/pref_service.cc |
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc |
index 433f8145ec2ae923e941a904ffca86032f3651c0..83e5463cca9066599f1ec0f26bb16af5f8e52dd7 100644 |
--- a/base/prefs/pref_service.cc |
+++ b/base/prefs/pref_service.cc |
@@ -86,7 +86,7 @@ void PrefService::CommitPendingWrite() { |
user_pref_store_->CommitPendingWrite(); |
} |
-bool PrefService::GetBoolean(const char* path) const { |
+bool PrefService::GetBoolean(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
bool result = false; |
@@ -101,7 +101,7 @@ bool PrefService::GetBoolean(const char* path) const { |
return result; |
} |
-int PrefService::GetInteger(const char* path) const { |
+int PrefService::GetInteger(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
int result = 0; |
@@ -116,7 +116,7 @@ int PrefService::GetInteger(const char* path) const { |
return result; |
} |
-double PrefService::GetDouble(const char* path) const { |
+double PrefService::GetDouble(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
double result = 0.0; |
@@ -131,7 +131,7 @@ double PrefService::GetDouble(const char* path) const { |
return result; |
} |
-std::string PrefService::GetString(const char* path) const { |
+std::string PrefService::GetString(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
std::string result; |
@@ -146,7 +146,7 @@ std::string PrefService::GetString(const char* path) const { |
return result; |
} |
-base::FilePath PrefService::GetFilePath(const char* path) const { |
+base::FilePath PrefService::GetFilePath(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
base::FilePath result; |
@@ -161,7 +161,7 @@ base::FilePath PrefService::GetFilePath(const char* path) const { |
return result; |
} |
-bool PrefService::HasPrefPath(const char* path) const { |
+bool PrefService::HasPrefPath(const std::string& path) const { |
const Preference* pref = FindPreference(path); |
return pref && !pref->IsDefaultValue(); |
} |
@@ -192,7 +192,7 @@ PrefService::GetPreferenceValuesWithoutPathExpansion() const { |
} |
const PrefService::Preference* PrefService::FindPreference( |
- const char* pref_name) const { |
+ const std::string& pref_name) const { |
DCHECK(CalledOnValidThread()); |
PreferenceMap::iterator it = prefs_map_.find(pref_name); |
if (it != prefs_map_.end()) |
@@ -225,18 +225,19 @@ PrefService::PrefInitializationStatus PrefService::GetInitializationStatus() |
} |
} |
-bool PrefService::IsManagedPreference(const char* pref_name) const { |
+bool PrefService::IsManagedPreference(const std::string& pref_name) const { |
const Preference* pref = FindPreference(pref_name); |
return pref && pref->IsManaged(); |
} |
-bool PrefService::IsUserModifiablePreference(const char* pref_name) const { |
+bool PrefService::IsUserModifiablePreference( |
+ const std::string& pref_name) const { |
const Preference* pref = FindPreference(pref_name); |
return pref && pref->IsUserModifiable(); |
} |
const base::DictionaryValue* PrefService::GetDictionary( |
- const char* path) const { |
+ const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
const base::Value* value = GetPreferenceValue(path); |
@@ -251,7 +252,8 @@ const base::DictionaryValue* PrefService::GetDictionary( |
return static_cast<const base::DictionaryValue*>(value); |
} |
-const base::Value* PrefService::GetUserPrefValue(const char* path) const { |
+const base::Value* PrefService::GetUserPrefValue( |
+ const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
const Preference* pref = FindPreference(path); |
@@ -274,13 +276,14 @@ const base::Value* PrefService::GetUserPrefValue(const char* path) const { |
return value; |
} |
-void PrefService::SetDefaultPrefValue(const char* path, |
+void PrefService::SetDefaultPrefValue(const std::string& path, |
base::Value* value) { |
DCHECK(CalledOnValidThread()); |
pref_registry_->SetDefaultPrefValue(path, value); |
} |
-const base::Value* PrefService::GetDefaultPrefValue(const char* path) const { |
+const base::Value* PrefService::GetDefaultPrefValue( |
+ const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
// Lookup the preference in the default store. |
const base::Value* value = NULL; |
@@ -291,7 +294,7 @@ const base::Value* PrefService::GetDefaultPrefValue(const char* path) const { |
return value; |
} |
-const base::ListValue* PrefService::GetList(const char* path) const { |
+const base::ListValue* PrefService::GetList(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
const base::Value* value = GetPreferenceValue(path); |
@@ -306,11 +309,12 @@ const base::ListValue* PrefService::GetList(const char* path) const { |
return static_cast<const base::ListValue*>(value); |
} |
-void PrefService::AddPrefObserver(const char* path, PrefObserver* obs) { |
+void PrefService::AddPrefObserver(const std::string& path, PrefObserver* obs) { |
pref_notifier_->AddPrefObserver(path, obs); |
} |
-void PrefService::RemovePrefObserver(const char* path, PrefObserver* obs) { |
+void PrefService::RemovePrefObserver(const std::string& path, |
+ PrefObserver* obs) { |
pref_notifier_->RemovePrefObserver(path, obs); |
} |
@@ -322,7 +326,7 @@ PrefRegistry* PrefService::DeprecatedGetPrefRegistry() { |
return pref_registry_.get(); |
} |
-void PrefService::ClearPref(const char* path) { |
+void PrefService::ClearPref(const std::string& path) { |
DCHECK(CalledOnValidThread()); |
const Preference* pref = FindPreference(path); |
@@ -333,35 +337,36 @@ void PrefService::ClearPref(const char* path) { |
user_pref_store_->RemoveValue(path); |
} |
-void PrefService::Set(const char* path, const base::Value& value) { |
+void PrefService::Set(const std::string& path, const base::Value& value) { |
SetUserPrefValue(path, value.DeepCopy()); |
} |
-void PrefService::SetBoolean(const char* path, bool value) { |
+void PrefService::SetBoolean(const std::string& path, bool value) { |
SetUserPrefValue(path, new base::FundamentalValue(value)); |
} |
-void PrefService::SetInteger(const char* path, int value) { |
+void PrefService::SetInteger(const std::string& path, int value) { |
SetUserPrefValue(path, new base::FundamentalValue(value)); |
} |
-void PrefService::SetDouble(const char* path, double value) { |
+void PrefService::SetDouble(const std::string& path, double value) { |
SetUserPrefValue(path, new base::FundamentalValue(value)); |
} |
-void PrefService::SetString(const char* path, const std::string& value) { |
+void PrefService::SetString(const std::string& path, const std::string& value) { |
SetUserPrefValue(path, new base::StringValue(value)); |
} |
-void PrefService::SetFilePath(const char* path, const base::FilePath& value) { |
+void PrefService::SetFilePath(const std::string& path, |
+ const base::FilePath& value) { |
SetUserPrefValue(path, base::CreateFilePathValue(value)); |
} |
-void PrefService::SetInt64(const char* path, int64 value) { |
+void PrefService::SetInt64(const std::string& path, int64 value) { |
SetUserPrefValue(path, new base::StringValue(base::Int64ToString(value))); |
} |
-int64 PrefService::GetInt64(const char* path) const { |
+int64 PrefService::GetInt64(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
const base::Value* value = GetPreferenceValue(path); |
@@ -378,11 +383,11 @@ int64 PrefService::GetInt64(const char* path) const { |
return val; |
} |
-void PrefService::SetUint64(const char* path, uint64 value) { |
+void PrefService::SetUint64(const std::string& path, uint64 value) { |
SetUserPrefValue(path, new base::StringValue(base::Uint64ToString(value))); |
} |
-uint64 PrefService::GetUint64(const char* path) const { |
+uint64 PrefService::GetUint64(const std::string& path) const { |
DCHECK(CalledOnValidThread()); |
const base::Value* value = GetPreferenceValue(path); |
@@ -399,7 +404,7 @@ uint64 PrefService::GetUint64(const char* path) const { |
return val; |
} |
-base::Value* PrefService::GetMutableUserPref(const char* path, |
+base::Value* PrefService::GetMutableUserPref(const std::string& path, |
base::Value::Type type) { |
CHECK(type == base::Value::TYPE_DICTIONARY || type == base::Value::TYPE_LIST); |
DCHECK(CalledOnValidThread()); |
@@ -436,7 +441,8 @@ void PrefService::ReportUserPrefChanged(const std::string& key) { |
user_pref_store_->ReportValueChanged(key); |
} |
-void PrefService::SetUserPrefValue(const char* path, base::Value* new_value) { |
+void PrefService::SetUserPrefValue(const std::string& path, |
+ base::Value* new_value) { |
scoped_ptr<base::Value> owned_value(new_value); |
DCHECK(CalledOnValidThread()); |
@@ -463,12 +469,9 @@ void PrefService::UpdateCommandLinePrefStore(PrefStore* command_line_store) { |
// PrefService::Preference |
PrefService::Preference::Preference(const PrefService* service, |
- const char* name, |
+ const std::string& name, |
base::Value::Type type) |
- : name_(name), |
- type_(type), |
- pref_service_(service) { |
- DCHECK(name); |
+ : name_(name), type_(type), pref_service_(service) { |
DCHECK(service); |
} |