Commit 99916154 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Account Manager flag cleanup: Chrome OS OOBE code

Chrome OS Account Manager has been turned on by default on ToT, and has
been launched via Finch for some time now. Clean up its flag's usages in
Chrome OS OOBE / Login related code.

Bug: 1009960
Change-Id: I1d999d22f515aa562fcdbf38aba11d91e5eeb0d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832278
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702074}
parent 26c51b90
......@@ -1172,8 +1172,7 @@ void UserSessionManager::InitializeAccountManager() {
base::FilePath profile_path =
ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash());
if (features::IsAccountManagerEnabled() &&
ProfileHelper::IsRegularProfilePath(profile_path)) {
if (ProfileHelper::IsRegularProfilePath(profile_path)) {
chromeos::InitializeAccountManager(
profile_path,
base::BindOnce(&UserSessionManager::PrepareProfile, AsWeakPtr(),
......@@ -1346,14 +1345,11 @@ void UserSessionManager::InitProfilePreferences(
}
bool should_use_legacy_flow = false;
if (!features::IsAccountManagerEnabled()) {
// Always use the legacy flow if Account Manager has not been enabled yet.
should_use_legacy_flow = true;
} else if (!identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(
gaia_id)
.has_value() &&
user_context.GetRefreshToken().empty()) {
if (!identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(
gaia_id)
.has_value() &&
user_context.GetRefreshToken().empty()) {
// Edge case: |AccountManager| is enabled but neither |IdentityManager|
// nor |user_context| has the refresh token. This means that an existing
// user has switched on Account Manager for the first time and has not
......
......@@ -14,7 +14,6 @@
#include "chrome/browser/signin/account_id_from_account_info.h"
#include "chrome/browser/signin/chrome_device_id_helper.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
......@@ -165,23 +164,13 @@ void OAuth2LoginManager::StoreOAuth2Token() {
const CoreAccountInfo primary_account_info =
identity_manager->GetPrimaryAccountInfo();
if (features::IsAccountManagerEnabled()) {
// If Account Manager is enabled, we already have the refresh token at this
// point, and will not get any additional callbacks from Account Manager or
// Identity Manager about refresh tokens. Manually call
// |OnRefreshTokenUpdatedForAccount| to continue the flow.
// TODO(https://crbug.com/977137): Clean this up after cleaning
// OAuth2LoginVerifier.
OnRefreshTokenUpdatedForAccount(primary_account_info);
} else {
// TODO(https://crbug.com/987955): Remove this when Account Manager is
// enabled by default.
identity_manager->GetAccountsMutator()->AddOrUpdateAccount(
primary_account_info.gaia, primary_account_info.email, refresh_token_,
primary_account_info.is_under_advanced_protection,
signin_metrics::SourceForRefreshTokenOperation::kUnknown);
}
// We already have the refresh token at this
// point, and will not get any additional callbacks from Account Manager or
// Identity Manager about refresh tokens. Manually call
// |OnRefreshTokenUpdatedForAccount| to continue the flow.
// TODO(https://crbug.com/977137): Clean this up after cleaning
// OAuth2LoginVerifier.
OnRefreshTokenUpdatedForAccount(primary_account_info);
}
void OAuth2LoginManager::VerifySessionCookies() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment