| Index: chrome/browser/chromeos/login/session/user_session_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| index 7c2aa36bbb7aabb19e729377b6c180ee8ee124f6..1efaa708ab48479b5b6e43ca67d903a177c5b22a 100644
|
| --- a/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| @@ -452,8 +452,7 @@
|
| delegate_ = delegate;
|
| start_session_type_ = start_session_type;
|
|
|
| - VLOG(1) << "Starting session for "
|
| - << user_context.GetAccountId().GetUserEmail();
|
| + VLOG(1) << "Starting session for " << user_context.GetUserID();
|
|
|
| PreStartSession();
|
| CreateUserSession(user_context, has_auth_cookies);
|
| @@ -467,7 +466,7 @@
|
|
|
| if (!user_context.GetDeviceId().empty()) {
|
| user_manager::UserManager::Get()->SetKnownUserDeviceId(
|
| - user_context.GetAccountId(), user_context.GetDeviceId());
|
| + user_context.GetUserID(), user_context.GetDeviceId());
|
| }
|
|
|
| PrepareProfile();
|
| @@ -703,7 +702,7 @@
|
| }
|
|
|
| bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const {
|
| - return user_context_.GetAccountId().is_valid() &&
|
| + return !user_context_.GetUserID().empty() &&
|
| user_manager::User::TypeHasGaiaAccount(user_context_.GetUserType()) &&
|
| user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty();
|
| }
|
| @@ -761,7 +760,7 @@
|
| if (!connection_error) {
|
| // We are in one of "done" states here.
|
| user_manager::UserManager::Get()->SaveUserOAuthStatus(
|
| - user_manager::UserManager::Get()->GetLoggedInUser()->GetAccountId(),
|
| + user_manager::UserManager::Get()->GetLoggedInUser()->email(),
|
| user_status);
|
| }
|
|
|
| @@ -864,7 +863,7 @@
|
| void UserSessionManager::StoreUserContextDataBeforeProfileIsCreated() {
|
| // Store obfuscated GAIA ID.
|
| if (!user_context_.GetGaiaID().empty()) {
|
| - user_manager::UserManager::Get()->UpdateGaiaID(user_context_.GetAccountId(),
|
| + user_manager::UserManager::Get()->UpdateGaiaID(user_context_.GetUserID(),
|
| user_context_.GetGaiaID());
|
| }
|
| }
|
| @@ -872,8 +871,8 @@
|
| void UserSessionManager::StartCrosSession() {
|
| BootTimesRecorder* btl = BootTimesRecorder::Get();
|
| btl->AddLoginTimeMarker("StartSession-Start", false);
|
| - DBusThreadManager::Get()->GetSessionManagerClient()->StartSession(
|
| - user_context_.GetAccountId().GetUserEmail());
|
| + DBusThreadManager::Get()->GetSessionManagerClient()->
|
| + StartSession(user_context_.GetUserID());
|
| btl->AddLoginTimeMarker("StartSession-End", false);
|
| }
|
|
|
| @@ -881,14 +880,15 @@
|
| BootTimesRecorder* btl = BootTimesRecorder::Get();
|
| btl->AddLoginTimeMarker("UserLoggedIn-Start", false);
|
| user_manager::UserManager* user_manager = user_manager::UserManager::Get();
|
| - user_manager->UserLoggedIn(user_context_.GetAccountId(),
|
| - user_context_.GetUserIDHash(), false);
|
| + user_manager->UserLoggedIn(user_context_.GetUserID(),
|
| + user_context_.GetUserIDHash(),
|
| + false);
|
| btl->AddLoginTimeMarker("UserLoggedIn-End", false);
|
| }
|
|
|
| void UserSessionManager::PrepareProfile() {
|
| - const bool is_demo_session = DemoAppLauncher::IsDemoAppSession(
|
| - user_context_.GetAccountId().GetUserEmail());
|
| + bool is_demo_session =
|
| + DemoAppLauncher::IsDemoAppSession(user_context_.GetUserID());
|
|
|
| // TODO(nkostylev): Figure out whether demo session is using the right profile
|
| // path or not. See https://codereview.chromium.org/171423009
|
| @@ -914,8 +914,9 @@
|
| // Profile is created, extensions and promo resources are initialized.
|
| // At this point all other Chrome OS services will be notified that it is
|
| // safe to use this profile.
|
| - UserProfileInitialized(profile, is_incognito_profile,
|
| - user_context.GetAccountId());
|
| + UserProfileInitialized(profile,
|
| + is_incognito_profile,
|
| + user_context.GetUserID());
|
| break;
|
| case Profile::CREATE_STATUS_LOCAL_FAIL:
|
| case Profile::CREATE_STATUS_REMOTE_FAIL:
|
| @@ -965,8 +966,8 @@
|
| if (gaia_id.empty()) {
|
| AccountTrackerService* account_tracker =
|
| AccountTrackerServiceFactory::GetForProfile(profile);
|
| - const AccountInfo info = account_tracker->FindAccountInfoByEmail(
|
| - user_context.GetAccountId().GetUserEmail());
|
| + AccountInfo info =
|
| + account_tracker->FindAccountInfoByEmail(user_context.GetUserID());
|
| gaia_id = info.gaia;
|
| DCHECK(!gaia_id.empty());
|
| }
|
| @@ -976,22 +977,22 @@
|
| // profiles that might not have it set yet).
|
| SigninManagerBase* signin_manager =
|
| SigninManagerFactory::GetForProfile(profile);
|
| - signin_manager->SetAuthenticatedAccountInfo(
|
| - gaia_id, user_context.GetAccountId().GetUserEmail());
|
| + signin_manager->SetAuthenticatedAccountInfo(gaia_id,
|
| + user_context.GetUserID());
|
|
|
| // Backfill GAIA ID in user prefs stored in Local State.
|
| std::string tmp_gaia_id;
|
| user_manager::UserManager* user_manager = user_manager::UserManager::Get();
|
| - if (!user_manager->FindGaiaID(user_context.GetAccountId(), &tmp_gaia_id) &&
|
| + if (!user_manager->FindGaiaID(user_context.GetUserID(), &tmp_gaia_id) &&
|
| !gaia_id.empty()) {
|
| - user_manager->UpdateGaiaID(user_context.GetAccountId(), gaia_id);
|
| + user_manager->UpdateGaiaID(user_context.GetUserID(), gaia_id);
|
| }
|
| }
|
| }
|
|
|
| void UserSessionManager::UserProfileInitialized(Profile* profile,
|
| bool is_incognito_profile,
|
| - const AccountId& account_id) {
|
| + const std::string& user_id) {
|
| // Demo user signed in.
|
| if (is_incognito_profile) {
|
| profile->OnLogin();
|
| @@ -1018,10 +1019,9 @@
|
| // first.
|
| bool transfer_saml_auth_cookies_on_subsequent_login = false;
|
| if (has_auth_cookies_ &&
|
| - g_browser_process->platform_part()
|
| - ->browser_policy_connector_chromeos()
|
| - ->GetUserAffiliation(account_id.GetUserEmail()) ==
|
| - policy::USER_AFFILIATION_MANAGED) {
|
| + g_browser_process->platform_part()->
|
| + browser_policy_connector_chromeos()->GetUserAffiliation(user_id) ==
|
| + policy::USER_AFFILIATION_MANAGED) {
|
| CrosSettings::Get()->GetBoolean(
|
| kAccountsPrefTransferSAMLCookies,
|
| &transfer_saml_auth_cookies_on_subsequent_login);
|
| @@ -1090,7 +1090,7 @@
|
| user_manager::UserManager* user_manager = user_manager::UserManager::Get();
|
| if (user_manager->IsLoggedInAsUserWithGaiaAccount()) {
|
| if (user_context_.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML)
|
| - user_manager->UpdateUsingSAML(user_context_.GetAccountId(), true);
|
| + user_manager->UpdateUsingSAML(user_context_.GetUserID(), true);
|
| SAMLOfflineSigninLimiter* saml_offline_signin_limiter =
|
| SAMLOfflineSigninLimiterFactory::GetForProfile(profile);
|
| if (saml_offline_signin_limiter)
|
| @@ -1123,10 +1123,10 @@
|
| user_context_.ClearSecrets();
|
| if (TokenHandlesEnabled()) {
|
| CreateTokenUtilIfMissing();
|
| - if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) {
|
| + if (token_handle_util_->ShouldObtainHandle(user->GetUserID())) {
|
| if (!token_handle_fetcher_.get()) {
|
| token_handle_fetcher_.reset(new TokenHandleFetcher(
|
| - token_handle_util_.get(), user->GetAccountId()));
|
| + token_handle_util_.get(), user->GetUserID()));
|
| token_handle_fetcher_->BackfillToken(
|
| profile, base::Bind(&UserSessionManager::OnTokenHandleObtained,
|
| weak_factory_.GetWeakPtr()));
|
| @@ -1438,7 +1438,7 @@
|
| DCHECK(!user_already_logged_in);
|
|
|
| if (!user_already_logged_in) {
|
| - UserContext user_context(AccountId::FromUserEmail(user_id));
|
| + UserContext user_context(user_id);
|
| user_context.SetUserIDHash(user_id_hash);
|
| user_context.SetIsUsingOAuth(false);
|
|
|
| @@ -1476,7 +1476,7 @@
|
| // TODO(xiyuan): Fix inconsistency user type of |user_context| introduced in
|
| // authenticator.
|
| const user_manager::User* user =
|
| - user_manager::UserManager::Get()->FindUser(user_context.GetAccountId());
|
| + user_manager::UserManager::Get()->FindUser(user_context.GetUserID());
|
| if (!user || !user->HasGaiaAccount())
|
| return;
|
|
|
| @@ -1501,7 +1501,7 @@
|
| key_manager->RefreshKeys(
|
| user_context, *device_list,
|
| base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, AsWeakPtr(),
|
| - user_context.GetAccountId().GetUserEmail()));
|
| + user_context.GetUserID()));
|
| }
|
|
|
| net::URLRequestContextGetter*
|
| @@ -1562,8 +1562,8 @@
|
| if (!easy_unlock_key_ops_finished_callback_.is_null())
|
| easy_unlock_key_ops_finished_callback_.Run();
|
|
|
| - const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
|
| - AccountId::FromUserEmail(user_id));
|
| + const user_manager::User* user =
|
| + user_manager::UserManager::Get()->FindUser(user_id);
|
| EasyUnlockService* easy_unlock_service =
|
| EasyUnlockService::GetForUser(*user);
|
| easy_unlock_service->CheckCryptohomeKeysAndMaybeHardlock();
|
| @@ -1724,9 +1724,9 @@
|
| void UserSessionManager::OnOAuth2TokensFetched(UserContext context) {
|
| if (StartupUtils::IsWebviewSigninEnabled() && TokenHandlesEnabled()) {
|
| CreateTokenUtilIfMissing();
|
| - if (token_handle_util_->ShouldObtainHandle(context.GetAccountId())) {
|
| + if (token_handle_util_->ShouldObtainHandle(context.GetUserID())) {
|
| token_handle_fetcher_.reset(new TokenHandleFetcher(
|
| - token_handle_util_.get(), context.GetAccountId()));
|
| + token_handle_util_.get(), context.GetUserID()));
|
| token_handle_fetcher_->FillForNewUser(
|
| context.GetAccessToken(),
|
| base::Bind(&UserSessionManager::OnTokenHandleObtained,
|
| @@ -1735,7 +1735,7 @@
|
| }
|
| }
|
|
|
| -void UserSessionManager::OnTokenHandleObtained(const AccountId& account_id,
|
| +void UserSessionManager::OnTokenHandleObtained(const user_manager::UserID& id,
|
| bool success) {
|
| if (!success)
|
| LOG(ERROR) << "OAuth2 token handle fetch failed.";
|
|
|