Commit a3dda216 authored by rogerta's avatar rogerta Committed by Commit bot

Add flag to track migration from email to gaia id.

BUG=341408

Review URL: https://codereview.chromium.org/475763005

Cr-Commit-Position: refs/heads/master@{#291737}
parent 0692b620
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/common/signin_pref_names.h"
AccountTrackerServiceFactory::AccountTrackerServiceFactory() AccountTrackerServiceFactory::AccountTrackerServiceFactory()
: BrowserContextKeyedServiceFactory( : BrowserContextKeyedServiceFactory(
...@@ -39,6 +40,10 @@ void AccountTrackerServiceFactory::RegisterProfilePrefs( ...@@ -39,6 +40,10 @@ void AccountTrackerServiceFactory::RegisterProfilePrefs(
registry->RegisterListPref( registry->RegisterListPref(
AccountTrackerService::kAccountInfoPref, AccountTrackerService::kAccountInfoPref,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_NOT_STARTED,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
} }
KeyedService* AccountTrackerServiceFactory::BuildServiceInstanceFor( KeyedService* AccountTrackerServiceFactory::BuildServiceInstanceFor(
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/prefs/scoped_user_pref_update.h" #include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_oauth_client.h" #include "google_apis/gaia/gaia_oauth_client.h"
...@@ -242,6 +243,18 @@ AccountTrackerService::FindAccountInfoByEmail( ...@@ -242,6 +243,18 @@ AccountTrackerService::FindAccountInfoByEmail(
return AccountInfo(); return AccountInfo();
} }
AccountTrackerService::AccountIdMigrationState
AccountTrackerService::GetMigrationState() {
return GetMigrationState(pref_service_);
}
// static
AccountTrackerService::AccountIdMigrationState
AccountTrackerService::GetMigrationState(PrefService* pref_service) {
return static_cast<AccountTrackerService::AccountIdMigrationState>(
pref_service->GetInteger(prefs::kAccountIdMigrationState));
}
void AccountTrackerService::OnRefreshTokenAvailable( void AccountTrackerService::OnRefreshTokenAvailable(
const std::string& account_id) { const std::string& account_id) {
TRACE_EVENT1("AccountTrackerService", TRACE_EVENT1("AccountTrackerService",
......
...@@ -48,6 +48,13 @@ class AccountTrackerService : public KeyedService, ...@@ -48,6 +48,13 @@ class AccountTrackerService : public KeyedService,
virtual void OnAccountRemoved(const AccountInfo& info) = 0; virtual void OnAccountRemoved(const AccountInfo& info) = 0;
}; };
// Possible values for the kAccountIdMigrationState preference.
enum AccountIdMigrationState {
MIGRATION_NOT_STARTED,
MIGRATION_IN_PROGRESS,
MIGRATION_DONE
};
AccountTrackerService(); AccountTrackerService();
virtual ~AccountTrackerService(); virtual ~AccountTrackerService();
...@@ -72,6 +79,9 @@ class AccountTrackerService : public KeyedService, ...@@ -72,6 +79,9 @@ class AccountTrackerService : public KeyedService,
// there are still unfininshed fetchers. // there are still unfininshed fetchers.
virtual bool IsAllUserInfoFetched() const; virtual bool IsAllUserInfoFetched() const;
AccountIdMigrationState GetMigrationState();
static AccountIdMigrationState GetMigrationState(PrefService* pref_service);
private: private:
friend class AccountInfoFetcher; friend class AccountInfoFetcher;
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
namespace prefs { namespace prefs {
// An integer property indicating the state of account id migration from
// email to gaia id for the the profile. See account_tracker_service.h
// for possible values.
const char kAccountIdMigrationState[] = "account_id_migration_state";
// Boolean identifying whether reverse auto-login is enabled. // Boolean identifying whether reverse auto-login is enabled.
const char kAutologinEnabled[] = "autologin.enabled"; const char kAutologinEnabled[] = "autologin.enabled";
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace prefs { namespace prefs {
extern const char kAccountIdMigrationState[];
extern const char kAutologinEnabled[]; extern const char kAutologinEnabled[];
extern const char kGoogleServicesLastUsername[]; extern const char kGoogleServicesLastUsername[];
extern const char kGoogleServicesUserAccountId[]; extern const char kGoogleServicesUserAccountId[];
......
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