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..e1bd4ae2cad80240fa1caff340c0a4a0ebf46e10 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::GetProfileActive(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::SetProfileActive(size_t index) { |
+ scoped_ptr<base::DictionaryValue> info( |
+ GetInfoForProfileAtIndex(index)->DeepCopy()); |
+ info->SetDouble(kActiveTimeKey, base::Time::Now().ToDoubleT()); |
+ // This takes ownership of |info|. |
+ SetInfoForProfileAtIndex(index, info.release()); |
+} |
+ |
void ProfileInfoCache::SetNameOfProfileAtIndex(size_t index, |
const base::string16& name) { |
scoped_ptr<base::DictionaryValue> info( |