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 2c1d80f166e7e4edac254274f0375594ff4ffb6f..59db267128760f8992bad15fcb64e7b301b8af69 100644 |
--- a/chrome/browser/profiles/profile_info_cache.cc |
+++ b/chrome/browser/profiles/profile_info_cache.cc |
@@ -1238,3 +1238,270 @@ void ProfileInfoCache::MigrateLegacyProfileNamesAndDownloadAvatars() { |
} |
#endif |
} |
+ |
+// ProfileMetadataStorage implementation |
noms (inactive)
2015/06/29 17:10:39
nit: . at the end?
Mike Lerman
2015/06/29 19:14:37
I didn't think we generally had leading comments l
|
+void ProfileInfoCache::AddProfile( |
+ const base::FilePath& profile_path, |
+ const base::string16& name, |
+ const std::string& gaia_id, |
+ const base::string16& user_name, |
+ size_t icon_index, |
+ const std::string& supervised_user_id) { |
+ AddProfileToCache( |
+ profile_path, name, gaia_id, user_name, icon_index, supervised_user_id); |
+} |
+void ProfileInfoCache::DeleteProfile(const base::FilePath& profile_path) { |
Mike Lerman
2015/06/29 19:14:37
nit: newline
|
+ DeleteProfileFromCache(profile_path); |
+} |
+ |
+std::vector<ProfileMetadataStorage::ProfileMetadataEntry> |
+ProfileInfoCache::GetAllProfilesMetadata() { |
noms (inactive)
2015/06/29 17:10:40
Yeah, here metadata is even worse (see the other c
anthonyvd
2015/06/30 21:24:52
You're absolutely right. I changed "Metadata" to "
Mike Lerman
2015/07/02 18:01:30
Ok, it makes sense to leave sorting to the callers
|
+ std::vector<ProfileMetadataStorage::ProfileMetadataEntry> ret; |
+ for (size_t i = 0; i < GetNumberOfProfiles(); ++i) { |
+ ProfileMetadataStorage::ProfileMetadataEntry entry; |
+ entry.profile_index_ = i; |
+ entry.profile_info_cache_ = this; |
+ ret.push_back(entry); |
+ } |
+ return ret; |
+} |
+ |
+bool ProfileInfoCache::GetProfileMetadataWithPath( |
+ const base::FilePath& path, ProfileMetadataEntry* entry) { |
noms (inactive)
2015/06/29 17:10:39
Idea: Why not return the `entry` (or null if it do
Mike Lerman
2015/06/29 19:14:37
I think the advantage of Anthony's implementation
anthonyvd
2015/06/30 21:24:52
Exactly. The main reason for crashes right now is
|
+ if (GetNumberOfProfiles() == 0) { |
+ return false; |
+ } |
+ |
+ size_t index = GetIndexOfProfileWithPath(path); |
+ if (index == std::string::npos) { |
+ return false; |
+ } |
+ |
+ entry->profile_index_ = index; |
noms (inactive)
2015/06/29 17:10:40
Weeeeeeeell if it's a private member, you probably
anthonyvd
2015/06/30 21:24:52
I wanted those to be private with the ProfileInfoC
|
+ entry->profile_info_cache_ = this; |
+ return true; |
+} |
+ |
+// ProfileMetadataEntry implementation |
+base::string16 ProfileMetadataStorage::ProfileMetadataEntry::GetName() const { |
noms (inactive)
2015/06/29 17:10:39
I think this should be in a different file, maybe.
Mike Lerman
2015/06/29 19:14:37
I agree - this seems like the wrong place for this
anthonyvd
2015/06/30 21:24:52
Good point, which kind of ties in to the other com
|
+ return profile_info_cache_->GetNameOfProfileAtIndex(profile_index_); |
+} |
+ |
+base::string16 ProfileMetadataStorage::ProfileMetadataEntry::GetShortcutName() |
+ const { |
+ return profile_info_cache_->GetShortcutNameOfProfileAtIndex(profile_index_); |
+} |
+ |
+base::FilePath ProfileMetadataStorage::ProfileMetadataEntry::GetPath() const { |
+ return profile_info_cache_->GetPathOfProfileAtIndex(profile_index_); |
+} |
+ |
+base::Time ProfileMetadataStorage::ProfileMetadataEntry::GetActiveTime() const { |
+ return profile_info_cache_->GetProfileActiveTimeAtIndex(profile_index_); |
+} |
+ |
+base::string16 ProfileMetadataStorage::ProfileMetadataEntry::GetUserName() |
+ const { |
+ return profile_info_cache_->GetUserNameOfProfileAtIndex(profile_index_); |
+} |
+ |
+const gfx::Image& |
+ProfileMetadataStorage::ProfileMetadataEntry::GetAvatarIcon() { |
+ return profile_info_cache_->GetAvatarIconOfProfileAtIndex(profile_index_); |
+} |
+ |
+std::string |
+ProfileMetadataStorage::ProfileMetadataEntry::GetLocalAuthCredentials() const { |
+ return profile_info_cache_->GetLocalAuthCredentialsOfProfileAtIndex( |
+ profile_index_); |
+} |
+ |
+std::string |
+ProfileMetadataStorage::ProfileMetadataEntry::GetPasswordChangeDetectionToken() |
+ const { |
+ return profile_info_cache_->GetPasswordChangeDetectionTokenAtIndex( |
+ profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::GetBackgroundStatus() const { |
+ return profile_info_cache_->GetBackgroundStatusOfProfileAtIndex( |
+ profile_index_); |
+} |
+ |
+base::string16 ProfileMetadataStorage::ProfileMetadataEntry::GetGAIAName() |
+ const { |
+ return profile_info_cache_->GetGAIANameOfProfileAtIndex(profile_index_); |
+} |
+ |
+base::string16 ProfileMetadataStorage::ProfileMetadataEntry::GetGAIAGivenName() |
+ const { |
+ return profile_info_cache_->GetGAIAGivenNameOfProfileAtIndex(profile_index_); |
+} |
+ |
+std::string ProfileMetadataStorage::ProfileMetadataEntry::GetGAIAId() const { |
+ return profile_info_cache_->GetGAIAIdOfProfileAtIndex(profile_index_); |
+} |
+ |
+const gfx::Image* ProfileMetadataStorage::ProfileMetadataEntry::GetGAIAPicture() |
+ const { |
+ return profile_info_cache_->GetGAIAPictureOfProfileAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsUsingGAIAPicture() |
+ const { |
+ return profile_info_cache_->IsUsingGAIAPictureOfProfileAtIndex( |
+ profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsSupervised() const { |
+ return profile_info_cache_->ProfileIsSupervisedAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsChild() const { |
+ return profile_info_cache_->ProfileIsChildAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsLegacySupervised() |
+ const { |
+ return profile_info_cache_->ProfileIsLegacySupervisedAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsOmitted() const { |
+ return profile_info_cache_->IsOmittedProfileAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsSigninRequired() const { |
+ return profile_info_cache_->ProfileIsSigninRequiredAtIndex(profile_index_); |
+} |
+ |
+std::string ProfileMetadataStorage::ProfileMetadataEntry::GetSupervisedUserId() |
+ const { |
+ return profile_info_cache_->GetSupervisedUserIdOfProfileAtIndex( |
+ profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsEphemeral() const { |
+ return profile_info_cache_->ProfileIsEphemeralAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsUsingDefaultName() |
+ const { |
+ return profile_info_cache_->ProfileIsUsingDefaultNameAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsAuthenticated() const { |
+ return profile_info_cache_->ProfileIsAuthenticatedAtIndex(profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsUsingDefaultAvatar() |
+ const { |
+ return profile_info_cache_->ProfileIsUsingDefaultAvatarAtIndex( |
+ profile_index_); |
+} |
+ |
+bool ProfileMetadataStorage::ProfileMetadataEntry::IsAuthError() const { |
+ return profile_info_cache_->ProfileIsAuthErrorAtIndex(profile_index_); |
+} |
+ |
+size_t ProfileMetadataStorage::ProfileMetadataEntry::GetAvatarIconIndex() |
+ const { |
+ return profile_info_cache_->GetAvatarIconIndexOfProfileAtIndex( |
+ profile_index_); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetName( |
+ const base::string16& name) { |
+ profile_info_cache_->SetNameOfProfileAtIndex(profile_index_, name); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetShortcutName( |
+ const base::string16& name) { |
+ profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index_, name); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsOmitted( |
+ bool is_omitted) { |
+ profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index_, is_omitted); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetSupervisedUserId( |
+ const std::string& id) { |
+ profile_info_cache_->SetSupervisedUserIdOfProfileAtIndex(profile_index_, id); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetLocalAuthCredentials( |
+ const std::string& auth) { |
+ profile_info_cache_->SetLocalAuthCredentialsOfProfileAtIndex( |
+ profile_index_, auth); |
+} |
+ |
+void |
+ProfileMetadataStorage::ProfileMetadataEntry::SetPasswordChangeDetectionToken( |
+ const std::string& token) { |
+ profile_info_cache_->SetPasswordChangeDetectionTokenAtIndex( |
+ profile_index_, token); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetBackgroundStatus( |
+ bool running_background_apps) { |
+ profile_info_cache_->SetBackgroundStatusOfProfileAtIndex( |
+ profile_index_, running_background_apps); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetGAIAName( |
+ const base::string16& name) { |
+ profile_info_cache_->SetGAIANameOfProfileAtIndex(profile_index_, name); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetGAIAGivenName( |
+ const base::string16& name) { |
+ profile_info_cache_->SetGAIAGivenNameOfProfileAtIndex(profile_index_, name); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetGAIAPicture( |
+ const gfx::Image* image) { |
+ profile_info_cache_->SetGAIAPictureOfProfileAtIndex(profile_index_, image); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsUsingGAIAPicture( |
+ bool value) { |
+ profile_info_cache_->SetIsUsingGAIAPictureOfProfileAtIndex( |
+ profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsSigninRequired( |
+ bool value) { |
+ profile_info_cache_->SetProfileSigninRequiredAtIndex(profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsEphemeral(bool value) { |
+ profile_info_cache_->SetProfileIsEphemeralAtIndex(profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsUsingDefaultName( |
+ bool value) { |
+ profile_info_cache_->SetProfileIsUsingDefaultNameAtIndex( |
+ profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsUsingDefaultAvatar( |
+ bool value) { |
+ profile_info_cache_->SetProfileIsUsingDefaultAvatarAtIndex( |
+ profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetIsAuthError(bool value) { |
+ profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index_, value); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetAvatarIconIndex( |
+ size_t icon_index) { |
+ profile_info_cache_->SetAvatarIconOfProfileAtIndex( |
+ profile_index_, icon_index); |
+} |
+ |
+void ProfileMetadataStorage::ProfileMetadataEntry::SetAuthInfo( |
+ const std::string& gaia_id, const base::string16& user_name) { |
+ profile_info_cache_->SetAuthInfoOfProfileAtIndex( |
+ profile_index_, gaia_id, user_name); |
+} |