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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: Address review comments Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { 908 if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) {
909 user_manager::User* active_user = 909 user_manager::User* active_user =
910 user_manager::UserManager::Get()->GetActiveUser(); 910 user_manager::UserManager::Get()->GetActiveUser();
911 std::string supervised_user_sync_id = 911 std::string supervised_user_sync_id =
912 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( 912 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId(
913 active_user->email()); 913 active_user->email());
914 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, 914 profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
915 supervised_user_sync_id); 915 supervised_user_sync_id);
916 } else if (user_manager::UserManager::Get()-> 916 } else if (user_manager::UserManager::Get()->
917 IsLoggedInAsUserWithGaiaAccount()) { 917 IsLoggedInAsUserWithGaiaAccount()) {
918 // Prime the account tracker with this combination of gaia id/display email. 918 // Get the Gaia ID from the user context. If it's not available, this may
919 // Don't do this unless both email and gaia_id are valid. They may not 919 // not be available when unlocking a previously opened profile, or when
920 // be when simply unlocking the profile. 920 // creating a supervised users. However, in these cases the gaia_id should
921 if (!user_context.GetGaiaID().empty() && 921 // be already available in the account tracker.
922 !user_context.GetUserID().empty()) { 922 std::string gaia_id = user_context.GetGaiaID();
923 if (gaia_id.empty()) {
923 AccountTrackerService* account_tracker = 924 AccountTrackerService* account_tracker =
924 AccountTrackerServiceFactory::GetForProfile(profile); 925 AccountTrackerServiceFactory::GetForProfile(profile);
925 account_tracker->SeedAccountInfo(user_context.GetGaiaID(), 926 AccountTrackerService::AccountInfo info =
926 user_context.GetUserID()); 927 account_tracker->FindAccountInfoByEmail(user_context.GetUserID());
928 gaia_id = info.gaia;
929 DCHECK(!gaia_id.empty());
927 } 930 }
928 931
929 // Make sure that the google service username is properly set (we do this 932 // Make sure that the google service username is properly set (we do this
930 // on every sign in, not just the first login, to deal with existing 933 // on every sign in, not just the first login, to deal with existing
931 // profiles that might not have it set yet). 934 // profiles that might not have it set yet).
932 SigninManagerBase* signin_manager = 935 SigninManagerBase* signin_manager =
933 SigninManagerFactory::GetForProfile(profile); 936 SigninManagerFactory::GetForProfile(profile);
934 signin_manager->SetAuthenticatedUsername(user_context.GetUserID()); 937 signin_manager->SetAuthenticatedAccountInfo(user_context.GetGaiaID(),
xiyuan 2015/04/09 20:59:21 Did you mean to use |gaia_id| here?
Roger Tawa OOO till Jul 10th 2015/04/10 01:52:57 Yes. First param is gaia-id, second is email.
xiyuan 2015/04/10 02:50:45 user_context.GetGaiaID() could return an empty str
Roger Tawa OOO till Jul 10th 2015/04/10 12:22:13 Oops, you are correct, totally missed that. Done.
938 user_context.GetUserID());
935 } 939 }
936 } 940 }
937 941
938 void UserSessionManager::UserProfileInitialized(Profile* profile, 942 void UserSessionManager::UserProfileInitialized(Profile* profile,
939 bool is_incognito_profile, 943 bool is_incognito_profile,
940 const std::string& user_id) { 944 const std::string& user_id) {
941 // Demo user signed in. 945 // Demo user signed in.
942 if (is_incognito_profile) { 946 if (is_incognito_profile) {
943 profile->OnLogin(); 947 profile->OnLogin();
944 948
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 if (is_enterprise_managed) 1611 if (is_enterprise_managed)
1608 display = USER_PODS_DISPLAY_DISABLED_MANAGED; 1612 display = USER_PODS_DISPLAY_DISABLED_MANAGED;
1609 else 1613 else
1610 display = USER_PODS_DISPLAY_DISABLED_REGULAR; 1614 display = USER_PODS_DISPLAY_DISABLED_REGULAR;
1611 } 1615 }
1612 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, 1616 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display,
1613 NUM_USER_PODS_DISPLAY); 1617 NUM_USER_PODS_DISPLAY);
1614 } 1618 }
1615 1619
1616 } // namespace chromeos 1620 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698