| Index: components/user_manager/known_user.cc
|
| diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc
|
| index 8ad90614b9f3444673b46fb8a9fdb69ee8a2a7a8..1a87612d7abc05142ad9c8f974561146e136e459 100644
|
| --- a/components/user_manager/known_user.cc
|
| +++ b/components/user_manager/known_user.cc
|
| @@ -32,6 +32,9 @@ const char kCanonicalEmail[] = "email";
|
| // Key of obfuscated GAIA id value.
|
| const char kGAIAIdKey[] = "gaia_id";
|
|
|
| +// Key of account type.
|
| +const char kAccountTypeKey[] = "account_type";
|
| +
|
| // Key of whether this user ID refers to a SAML user.
|
| const char kUsingSAMLKey[] = "using_saml";
|
|
|
| @@ -78,6 +81,9 @@ void UpdateIdentity(const AccountId& account_id, base::DictionaryValue& dict) {
|
|
|
| if (!account_id.GetGaiaId().empty())
|
| dict.SetString(kGAIAIdKey, account_id.GetGaiaId());
|
| +
|
| + if (!account_id.GetAccountType().empty())
|
| + dict.SetString(kAccountTypeKey, account_id.GetAccountType());
|
| }
|
|
|
| } // namespace
|
| @@ -243,8 +249,16 @@ AccountId GetAccountId(const std::string& user_email,
|
| if (!gaia_id.empty() && gaia_id != stored_gaia_id)
|
| LOG(ERROR) << "User gaia id has changed. Sync will not work.";
|
|
|
| + AccountId account_id =
|
| + AccountId::FromUserEmailGaiaId(sanitized_email, stored_gaia_id);
|
| + std::string stored_account_type;
|
| + if (!sanitized_email.empty() &&
|
| + GetStringPref(AccountId::FromUserEmail(sanitized_email),
|
| + kAccountTypeKey, &stored_account_type)) {
|
| + account_id.SetAccountType(stored_account_type);
|
| + }
|
| // gaia_id is associated with cryptohome.
|
| - return AccountId::FromUserEmailGaiaId(sanitized_email, stored_gaia_id);
|
| + return account_id;
|
| }
|
|
|
| std::string stored_email;
|
| @@ -274,10 +288,17 @@ std::vector<AccountId> GetKnownAccountIds() {
|
| if (known_users->GetDictionary(i, &element)) {
|
| std::string email;
|
| std::string gaia_id;
|
| + std::string account_type;
|
| const bool has_email = element->GetString(kCanonicalEmail, &email);
|
| const bool has_gaia_id = element->GetString(kGAIAIdKey, &gaia_id);
|
| - if (has_email || has_gaia_id)
|
| - result.push_back(AccountId::FromUserEmailGaiaId(email, gaia_id));
|
| + const bool has_account_type =
|
| + element->GetString(kAccountTypeKey, &account_type);
|
| + if (has_email || has_gaia_id) {
|
| + AccountId account_id = AccountId::FromUserEmailGaiaId(email, gaia_id);
|
| + if (has_account_type)
|
| + account_id.SetAccountType(account_type);
|
| + result.push_back(account_id);
|
| + }
|
| }
|
| }
|
| return result;
|
|
|