Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 5e02bee7af2c79596de38be0bce4e63ec5fa946c..b0231dd6c969424f3b4730b4c940ad652aac9d07 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -420,8 +420,8 @@ void ProfileManager::CreateProfileAsync(
std::string icon_url_std = base::UTF16ToASCII(icon_url);
if (profiles::IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) {
// add profile to cache with user selected name and avatar
- cache.AddProfileToCache(profile_path, name, base::string16(), icon_index,
- supervised_user_id);
+ cache.AddProfileToCache(profile_path, name, std::string(),
+ base::string16(), icon_index, supervised_user_id);
}
if (!supervised_user_id.empty()) {
@@ -1203,9 +1203,8 @@ void ProfileManager::FinishDeletingProfile(
profile)->DisableForUser();
}
- bool profile_is_signed_in = !cache.GetUserNameOfProfileAtIndex(
- cache.GetIndexOfProfileWithPath(profile_dir)).empty();
- ProfileMetrics::LogProfileDelete(profile_is_signed_in);
+ ProfileMetrics::LogProfileDelete(cache.ProfileIsAuthenticatedAtIndex(
+ cache.GetIndexOfProfileWithPath(profile_dir)));
// Some platforms store passwords in keychains. They should be removed.
scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(
@@ -1257,13 +1256,18 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile);
- base::string16 username = base::UTF8ToUTF16(
- signin_manager->GetAuthenticatedUsername());
+ AccountTrackerService* account_tracker =
+ AccountTrackerServiceFactory::GetForProfile(profile);
+ AccountTrackerService::AccountInfo account_info =
+ account_tracker->GetAccountInfo(
+ signin_manager->GetAuthenticatedAccountId());
+ base::string16 username = base::UTF8ToUTF16(account_info.email);
size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
if (profile_index != std::string::npos) {
- // The ProfileInfoCache's username must match the Signin Manager's username.
- cache.SetUserNameOfProfileAtIndex(profile_index, username);
+ // The ProfileInfoCache's info must match the Signin Manager.
+ cache.SetAuthInfoOfProfileAtIndex(profile_index, account_info.gaia,
+ username);
return;
}
@@ -1280,6 +1284,7 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
cache.AddProfileToCache(profile->GetPath(),
profile_name,
+ account_info.gaia,
username,
icon_index,
supervised_user_id);
« no previous file with comments | « chrome/browser/profiles/profile_list_desktop_unittest.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698