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/pref_service.h" | 5 #include "chrome/browser/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 660 } |
661 | 661 |
662 int64 PrefService::GetInt64(const char* path) const { | 662 int64 PrefService::GetInt64(const char* path) const { |
663 DCHECK(CalledOnValidThread()); | 663 DCHECK(CalledOnValidThread()); |
664 | 664 |
665 const Preference* pref = FindPreference(path); | 665 const Preference* pref = FindPreference(path); |
666 if (!pref) { | 666 if (!pref) { |
667 NOTREACHED() << "Trying to read an unregistered pref: " << path; | 667 NOTREACHED() << "Trying to read an unregistered pref: " << path; |
668 return 0; | 668 return 0; |
669 } | 669 } |
670 std::wstring result(L"0"); | 670 std::string result("0"); |
671 bool rv = pref->GetValue()->GetAsString(&result); | 671 bool rv = pref->GetValue()->GetAsString(&result); |
672 DCHECK(rv); | 672 DCHECK(rv); |
673 | 673 |
674 int64 val; | 674 int64 val; |
675 base::StringToInt64(WideToUTF8(result), &val); | 675 base::StringToInt64(result, &val); |
676 return val; | 676 return val; |
677 } | 677 } |
678 | 678 |
679 void PrefService::RegisterInt64Pref(const char* path, int64 default_value) { | 679 void PrefService::RegisterInt64Pref(const char* path, int64 default_value) { |
680 Preference* pref = new Preference(pref_value_store_.get(), path, | 680 Preference* pref = new Preference(pref_value_store_.get(), path, |
681 Value::CreateStringValue(base::Int64ToString(default_value))); | 681 Value::CreateStringValue(base::Int64ToString(default_value))); |
682 RegisterPreference(pref); | 682 RegisterPreference(pref); |
683 } | 683 } |
684 | 684 |
685 DictionaryValue* PrefService::GetMutableDictionary(const char* path) { | 685 DictionaryValue* PrefService::GetMutableDictionary(const char* path) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 ChromeThread::PostTask( | 830 ChromeThread::PostTask( |
831 ChromeThread::UI, FROM_HERE, | 831 ChromeThread::UI, FROM_HERE, |
832 NewRunnableMethod( | 832 NewRunnableMethod( |
833 pref_value_store_.get(), | 833 pref_value_store_.get(), |
834 &PrefValueStore::RefreshPolicyPrefs, | 834 &PrefValueStore::RefreshPolicyPrefs, |
835 ConfigurationPolicyPrefStore::CreateManagedPolicyPrefStore(), | 835 ConfigurationPolicyPrefStore::CreateManagedPolicyPrefStore(), |
836 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(), | 836 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(), |
837 callback)); | 837 callback)); |
838 } | 838 } |
839 } | 839 } |
OLD | NEW |