| Index: chrome/common/pref_service.cc
|
| ===================================================================
|
| --- chrome/common/pref_service.cc (revision 10828)
|
| +++ chrome/common/pref_service.cc (working copy)
|
| @@ -289,7 +289,7 @@
|
| DCHECK(CalledOnValidThread());
|
|
|
| bool result = false;
|
| - if (transient_->GetBoolean(path, &result))
|
| + if (transient_->GetBoolean(WideToUTF16Hack(path), &result))
|
| return result;
|
|
|
| const Preference* pref = FindPreference(path);
|
| @@ -306,7 +306,7 @@
|
| DCHECK(CalledOnValidThread());
|
|
|
| int result = 0;
|
| - if (transient_->GetInteger(path, &result))
|
| + if (transient_->GetInteger(WideToUTF16Hack(path), &result))
|
| return result;
|
|
|
| const Preference* pref = FindPreference(path);
|
| @@ -323,7 +323,7 @@
|
| DCHECK(CalledOnValidThread());
|
|
|
| double result = 0.0;
|
| - if (transient_->GetReal(path, &result))
|
| + if (transient_->GetReal(WideToUTF16Hack(path), &result))
|
| return result;
|
|
|
| const Preference* pref = FindPreference(path);
|
| @@ -339,10 +339,11 @@
|
| std::wstring PrefService::GetString(const wchar_t* path) const {
|
| DCHECK(CalledOnValidThread());
|
|
|
| + string16 result16;
|
| + if (transient_->GetString(WideToUTF16Hack(path), &result16))
|
| + return UTF16ToWideHack(result16);
|
| +
|
| std::wstring result;
|
| - if (transient_->GetString(path, &result))
|
| - return result;
|
| -
|
| const Preference* pref = FindPreference(path);
|
| if (!pref) {
|
| #if defined(OS_WIN)
|
| @@ -359,7 +360,8 @@
|
|
|
| bool PrefService::HasPrefPath(const wchar_t* path) const {
|
| Value* value = NULL;
|
| - return (transient_->Get(path, &value) || persistent_->Get(path, &value));
|
| + string16 path16 = WideToUTF16Hack(path);
|
| + return (transient_->Get(path16, &value) || persistent_->Get(path16, &value));
|
| }
|
|
|
| const PrefService::Preference* PrefService::FindPreference(
|
| @@ -374,7 +376,7 @@
|
| DCHECK(CalledOnValidThread());
|
|
|
| DictionaryValue* result = NULL;
|
| - if (transient_->GetDictionary(path, &result))
|
| + if (transient_->GetDictionary(WideToUTF16Hack(path), &result))
|
| return result;
|
|
|
| const Preference* pref = FindPreference(path);
|
| @@ -392,7 +394,7 @@
|
| DCHECK(CalledOnValidThread());
|
|
|
| ListValue* result = NULL;
|
| - if (transient_->GetList(path, &result))
|
| + if (transient_->GetList(WideToUTF16Hack(path), &result))
|
| return result;
|
|
|
| const Preference* pref = FindPreference(path);
|
| @@ -473,10 +475,11 @@
|
| return;
|
| }
|
|
|
| - transient_->Remove(path, NULL);
|
| + string16 path16 = WideToUTF16Hack(path);
|
| + transient_->Remove(path16, NULL);
|
| Value* value;
|
| - bool has_old_value = persistent_->Get(path, &value);
|
| - persistent_->Remove(path, NULL);
|
| + bool has_old_value = persistent_->Get(path16, &value);
|
| + persistent_->Remove(path16, NULL);
|
|
|
| if (has_old_value)
|
| FireObservers(path);
|
| @@ -496,7 +499,7 @@
|
| }
|
|
|
| scoped_ptr<Value> old_value(GetPrefCopy(path));
|
| - bool rv = persistent_->SetBoolean(path, value);
|
| + bool rv = persistent_->SetBoolean(WideToUTF16Hack(path), value);
|
| DCHECK(rv);
|
|
|
| FireObserversIfChanged(path, old_value.get());
|
| @@ -516,7 +519,7 @@
|
| }
|
|
|
| scoped_ptr<Value> old_value(GetPrefCopy(path));
|
| - bool rv = persistent_->SetInteger(path, value);
|
| + bool rv = persistent_->SetInteger(WideToUTF16Hack(path), value);
|
| DCHECK(rv);
|
|
|
| FireObserversIfChanged(path, old_value.get());
|
| @@ -536,7 +539,7 @@
|
| }
|
|
|
| scoped_ptr<Value> old_value(GetPrefCopy(path));
|
| - bool rv = persistent_->SetReal(path, value);
|
| + bool rv = persistent_->SetReal(WideToUTF16Hack(path), value);
|
| DCHECK(rv);
|
|
|
| FireObserversIfChanged(path, old_value.get());
|
| @@ -556,7 +559,8 @@
|
| }
|
|
|
| scoped_ptr<Value> old_value(GetPrefCopy(path));
|
| - bool rv = persistent_->SetString(path, value);
|
| + bool rv = persistent_->SetString(WideToUTF16Hack(path),
|
| + WideToUTF16Hack(value));
|
| DCHECK(rv);
|
|
|
| FireObserversIfChanged(path, old_value.get());
|
| @@ -576,10 +580,11 @@
|
| }
|
|
|
| DictionaryValue* dict = NULL;
|
| - bool rv = persistent_->GetDictionary(path, &dict);
|
| + string16 path16 = WideToUTF16Hack(path);
|
| + bool rv = persistent_->GetDictionary(path16, &dict);
|
| if (!rv) {
|
| dict = new DictionaryValue;
|
| - rv = persistent_->Set(path, dict);
|
| + rv = persistent_->Set(path16, dict);
|
| DCHECK(rv);
|
| }
|
| return dict;
|
| @@ -599,10 +604,11 @@
|
| }
|
|
|
| ListValue* list = NULL;
|
| - bool rv = persistent_->GetList(path, &list);
|
| + string16 path16 = WideToUTF16Hack(path);
|
| + bool rv = persistent_->GetList(path16, &list);
|
| if (!rv) {
|
| list = new ListValue;
|
| - rv = persistent_->Set(path, list);
|
| + rv = persistent_->Set(path16, list);
|
| DCHECK(rv);
|
| }
|
| return list;
|
| @@ -619,7 +625,7 @@
|
| void PrefService::FireObserversIfChanged(const wchar_t* path,
|
| const Value* old_value) {
|
| Value* new_value = NULL;
|
| - persistent_->Get(path, &new_value);
|
| + persistent_->Get(WideToUTF16Hack(path), &new_value);
|
| if (!old_value->Equals(new_value))
|
| FireObservers(path);
|
| }
|
| @@ -672,7 +678,7 @@
|
| "Must register pref before getting its value";
|
|
|
| Value* temp_value = NULL;
|
| - if (root_pref_->Get(name_.c_str(), &temp_value) &&
|
| + if (root_pref_->Get(WideToUTF16Hack(name_), &temp_value) &&
|
| temp_value->GetType() == type_) {
|
| return temp_value;
|
| }
|
|
|