summaryrefslogtreecommitdiffstats
path: root/components/user_manager
diff options
context:
space:
mode:
authoralemate <alemate@chromium.org>2016-01-14 09:44:17 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-14 17:46:30 +0000
commit757972a9991ed5aca263421cb961e6e9ce681c1d (patch)
tree4f5199e8953fc4eba272f25b7b07a10ef1c68529 /components/user_manager
parent21b70beb7e5ce84eb4467c7082fcb2c00a764b1f (diff)
downloadchromium_src-757972a9991ed5aca263421cb961e6e9ce681c1d.zip
chromium_src-757972a9991ed5aca263421cb961e6e9ce681c1d.tar.gz
chromium_src-757972a9991ed5aca263421cb961e6e9ce681c1d.tar.bz2
ChromeOS: Add known_user Get/Set GaiaIdMigrationStatus.
BUG=462823 TEST=none Review URL: https://codereview.chromium.org/1582663002 Cr-Commit-Position: refs/heads/master@{#369452}
Diffstat (limited to 'components/user_manager')
-rw-r--r--components/user_manager/known_user.cc22
-rw-r--r--components/user_manager/known_user.h9
2 files changed, 31 insertions, 0 deletions
diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc
index b9adce4..18c1fac 100644
--- a/components/user_manager/known_user.cc
+++ b/components/user_manager/known_user.cc
@@ -42,6 +42,9 @@ const char kGAPSCookie[] = "gaps_cookie";
// Key of the reason for re-auth.
const char kReauthReasonKey[] = "reauth_reason";
+// Key for the GaiaId migration status.
+const char kGaiaIdMigration[] = "gaia_id_migration";
+
PrefService* GetLocalState() {
UserManager* user_manager = UserManager::Get();
if (user_manager)
@@ -253,6 +256,25 @@ AccountId GetAccountId(const std::string& user_email,
: AccountId::FromUserEmailGaiaId(user_email, gaia_id));
}
+bool GetGaiaIdMigrationStatus(const AccountId& account_id,
+ const std::string& subsystem) {
+ bool migrated = false;
+
+ if (GetBooleanPref(account_id,
+ std::string(kGaiaIdMigration) + "." + subsystem,
+ &migrated)) {
+ return migrated;
+ }
+
+ return false;
+}
+
+void SetGaiaIdMigrationStatusDone(const AccountId& account_id,
+ const std::string& subsystem) {
+ SetBooleanPref(account_id, std::string(kGaiaIdMigration) + "." + subsystem,
+ true);
+}
+
void UpdateGaiaID(const AccountId& account_id, const std::string& gaia_id) {
SetStringPref(account_id, kGAIAIdKey, gaia_id);
}
diff --git a/components/user_manager/known_user.h b/components/user_manager/known_user.h
index 03528dc..aa02b2f 100644
--- a/components/user_manager/known_user.h
+++ b/components/user_manager/known_user.h
@@ -74,6 +74,15 @@ void USER_MANAGER_EXPORT SetIntegerPref(const AccountId& account_id,
AccountId USER_MANAGER_EXPORT GetAccountId(const std::string& user_email,
const std::string& gaia_id);
+// Returns true if |subsystem| data was migrated to GaiaId for the |account_id|.
+bool USER_MANAGER_EXPORT GetGaiaIdMigrationStatus(const AccountId& account_id,
+ const std::string& subsystem);
+
+// Marks |subsystem| migrated to GaiaId for the |account_id|.
+void USER_MANAGER_EXPORT
+SetGaiaIdMigrationStatusDone(const AccountId& account_id,
+ const std::string& subsystem);
+
// Updates |gaia_id| for user with |account_id|.
// TODO(alemate): Update this once AccountId contains GAIA ID
// (crbug.com/548926).