Commit 6c90100a authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

Regroup and trim IdentityManager methods for account ID migration

Groups these related methods together and eliminates one method that
has no production callers.

Bug: 970295
Change-Id: I07c9f79862efcf94b28ad7c2571b0a33a77be316
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729264Reviewed-by: default avatarLowell Manners <lowell@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683112}
parent a953038a
......@@ -392,9 +392,19 @@ void IdentityManager::OnNetworkInitialized() {
account_fetcher_service_->OnNetworkInitialized();
}
// static
bool IdentityManager::IsAccountIdMigrationSupported() {
return AccountTrackerService::IsMigrationSupported();
IdentityManager::AccountIdMigrationState
IdentityManager::GetAccountIdMigrationState() const {
return static_cast<IdentityManager::AccountIdMigrationState>(
account_tracker_service_->GetMigrationState());
}
CoreAccountId IdentityManager::PickAccountIdForAccount(
const std::string& gaia,
const std::string& email) const {
// TODO(triploblastic@): Remove explicit conversion once
// primary_account_manager has been fixed to use CoreAccountId.
return CoreAccountId(
account_tracker_service_->PickAccountIdForAccount(gaia, email));
}
// static
......@@ -413,21 +423,6 @@ void IdentityManager::RegisterProfilePrefs(PrefRegistrySimple* registry) {
#endif
}
CoreAccountId IdentityManager::PickAccountIdForAccount(
const std::string& gaia,
const std::string& email) const {
// TODO(triploblastic@): Remove explicit conversion once
// primary_account_manager has been fixed to use CoreAccountId.
return CoreAccountId(
account_tracker_service_->PickAccountIdForAccount(gaia, email));
}
IdentityManager::AccountIdMigrationState
IdentityManager::GetAccountIdMigrationState() const {
return static_cast<IdentityManager::AccountIdMigrationState>(
account_tracker_service_->GetMigrationState());
}
#if !defined(OS_IOS) && !defined(OS_ANDROID)
void IdentityManager::DeprecatedLoadCredentialsForSupervisedUser(
const CoreAccountId& primary_account_id) {
......
......@@ -394,22 +394,10 @@ class IdentityManager : public KeyedService,
// initialized.
void OnNetworkInitialized();
// Returns |true| if migration of the account ID from normalized email is
// supported for the current platform.
static bool IsAccountIdMigrationSupported();
// Registers per-install prefs used by this class.
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// Registers per-profile prefs used by this class.
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
// Picks the correct account_id for the specified account depending on the
// migration state.
// TODO(https://crbug.com/883272): Remove once all platform have migrated to
// the new account_id based on gaia (currently, only Chrome OS remains).
CoreAccountId PickAccountIdForAccount(const std::string& gaia,
const std::string& email) const;
// Methods related to migration of account IDs from email to Gaia ID.
// TODO(https://crbug.com/883272): Remove these once all platforms have
// migrated to the new account_id based on gaia (currently, only ChromeOS
// remains).
// Possible values for the account ID migration state, needs to be kept in
// sync with AccountTrackerService::AccountIdMigrationState.
......@@ -420,9 +408,21 @@ class IdentityManager : public KeyedService,
NUM_MIGRATION_STATES
};
// Returns the currently saved state for the migration of accounts IDs.
// Returns the currently saved state of the migration of account IDs.
AccountIdMigrationState GetAccountIdMigrationState() const;
// Picks the correct account_id for the specified account depending on the
// migration state.
CoreAccountId PickAccountIdForAccount(const std::string& gaia,
const std::string& email) const;
// Methods used only by embedder-level factory classes.
// Registers per-install prefs used by this class.
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// Registers per-profile prefs used by this class.
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
#if !defined(OS_IOS) && !defined(OS_ANDROID)
// Explicitly triggers the loading of accounts in the context of supervised
// users.
......
......@@ -2148,7 +2148,7 @@ TEST_F(IdentityManagerTest, AreRefreshTokensLoaded) {
TEST_F(IdentityManagerTest, AccountIdMigration_DoneOnInitialization) {
// Migration gets marked as DONE while initializing the AccountTrackerService
// on platforms supporting account ID migration only.
if (IdentityManager::IsAccountIdMigrationSupported()) {
if (account_tracker()->IsMigrationSupported()) {
EXPECT_EQ(identity_manager()->GetAccountIdMigrationState(),
IdentityManager::AccountIdMigrationState::MIGRATION_DONE);
} else {
......
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