| Index: components/prefs/pref_service.cc
|
| diff --git a/components/prefs/pref_service.cc b/components/prefs/pref_service.cc
|
| index 4891ff59c669af84f3e3cb987932e27142f77e07..ed1e046bb7a408f9c742df1a5e712c74bc672f4e 100644
|
| --- a/components/prefs/pref_service.cc
|
| +++ b/components/prefs/pref_service.cc
|
| @@ -188,6 +188,22 @@ base::FilePath PrefService::GetFilePath(const std::string& path) const {
|
| return result;
|
| }
|
|
|
| +base::Time PrefService::GetTime(const std::string& path) const {
|
| + DCHECK(CalledOnValidThread());
|
| +
|
| + const base::Value* value = GetPreferenceValue(path);
|
| + if (!value) {
|
| + NOTREACHED() << "Trying to read an unregistered pref: " << path;
|
| + return base::Time();
|
| + }
|
| + std::string value_string;
|
| + int64_t value_int = 0;
|
| + bool rv = (value->GetAsString(&value_string) &&
|
| + base::StringToInt64(value_string, &value_int));
|
| + DCHECK(rv);
|
| + return base::Time::FromInternalValue(value_int);
|
| +}
|
| +
|
| bool PrefService::HasPrefPath(const std::string& path) const {
|
| const Preference* pref = FindPreference(path);
|
| return pref && !pref->IsDefaultValue();
|
| @@ -409,6 +425,11 @@ void PrefService::SetFilePath(const std::string& path,
|
| SetUserPrefValue(path, base::CreateFilePathValue(value));
|
| }
|
|
|
| +void PrefService::SetTime(const std::string& path, base::Time value) {
|
| + SetUserPrefValue(path, new base::StringValue(
|
| + base::Int64ToString(value.ToInternalValue())));
|
| +}
|
| +
|
| void PrefService::SetInt64(const std::string& path, int64_t value) {
|
| SetUserPrefValue(path, new base::StringValue(base::Int64ToString(value)));
|
| }
|
|
|