| Index: chrome/browser/profiles/profile_info_cache.cc
|
| diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
|
| index 6aeedf0f99b10a44e9b24848bd342f33384aa1b4..d9ff4ee37060e842b5ae61b70a3bcc18eb2eb507 100644
|
| --- a/chrome/browser/profiles/profile_info_cache.cc
|
| +++ b/chrome/browser/profiles/profile_info_cache.cc
|
| @@ -53,6 +53,7 @@ const char kIsManagedKey[] = "is_managed";
|
| const char kSigninRequiredKey[] = "signin_required";
|
| const char kManagedUserId[] = "managed_user_id";
|
| const char kProfileIsEphemeral[] = "is_ephemeral";
|
| +const char kActiveTimeKey[] = "active_time";
|
|
|
| const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_";
|
| const char kGAIAPictureFileName[] = "Google Profile Picture.png";
|
| @@ -309,6 +310,15 @@ base::FilePath ProfileInfoCache::GetPathOfProfileAtIndex(size_t index) const {
|
| return user_data_dir_.AppendASCII(sorted_keys_[index]);
|
| }
|
|
|
| +base::Time ProfileInfoCache::GetProfileActiveTimeAtIndex(size_t index) const {
|
| + double dt;
|
| + if (GetInfoForProfileAtIndex(index)->GetDouble(kActiveTimeKey, &dt)) {
|
| + return base::Time::FromDoubleT(dt);
|
| + } else {
|
| + return base::Time();
|
| + }
|
| +}
|
| +
|
| base::string16 ProfileInfoCache::GetUserNameOfProfileAtIndex(
|
| size_t index) const {
|
| base::string16 user_name;
|
| @@ -474,6 +484,14 @@ size_t ProfileInfoCache::GetAvatarIconIndexOfProfileAtIndex(size_t index)
|
| return icon_index;
|
| }
|
|
|
| +void ProfileInfoCache::SetProfileActiveTimeAtIndex(size_t index) {
|
| + scoped_ptr<base::DictionaryValue> info(
|
| + GetInfoForProfileAtIndex(index)->DeepCopy());
|
| + info->SetDouble(kActiveTimeKey, base::Time::Now().ToDoubleT());
|
| + // This takes ownership of |info|.
|
| + SetInfoQuietlyForProfileAtIndex(index, info.release());
|
| +}
|
| +
|
| void ProfileInfoCache::SetNameOfProfileAtIndex(size_t index,
|
| const base::string16& name) {
|
| scoped_ptr<base::DictionaryValue> info(
|
| @@ -869,11 +887,17 @@ const base::DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex(
|
| return info;
|
| }
|
|
|
| -void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index,
|
| - base::DictionaryValue* info) {
|
| +void ProfileInfoCache::SetInfoQuietlyForProfileAtIndex(
|
| + size_t index, base::DictionaryValue* info) {
|
| DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
|
| base::DictionaryValue* cache = update.Get();
|
| cache->SetWithoutPathExpansion(sorted_keys_[index], info);
|
| +}
|
| +
|
| +// TODO(noms): Switch to newer notification system.
|
| +void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index,
|
| + base::DictionaryValue* info) {
|
| + SetInfoQuietlyForProfileAtIndex(index, info);
|
|
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
|
|
|