Commit 2ce90c50 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS: Fallback to user e-mail when loading user types.

There are still some very old users on some devices, that do not have
full profile information in Local State users list. This Cl falls back to
UserEmail as a key in user_types list, and implements migration, so that
this will not trigger CHECK again.

Bug: 795380
Change-Id: Ic1c4ecbae2118be922417fb09de96df6e89aa316
Reviewed-on: https://chromium-review.googlesource.com/835531
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525246}
parent 61e89030
...@@ -75,8 +75,9 @@ const int kLogoutToLoginDelayMaxSec = 1800; ...@@ -75,8 +75,9 @@ const int kLogoutToLoginDelayMaxSec = 1800;
// interpretes it as UserType. It is used in initial users load. // interpretes it as UserType. It is used in initial users load.
UserType GetStoredUserType(const base::DictionaryValue* prefs_user_types, UserType GetStoredUserType(const base::DictionaryValue* prefs_user_types,
const AccountId& account_id) { const AccountId& account_id) {
const base::Value* stored_user_type = const base::Value* stored_user_type = prefs_user_types->FindKey(
prefs_user_types->FindKey(account_id.GetAccountIdKey()); account_id.HasAccountIdKey() ? account_id.GetAccountIdKey()
: account_id.GetUserEmail());
if (!stored_user_type || !stored_user_type->is_int()) if (!stored_user_type || !stored_user_type->is_int())
return USER_TYPE_REGULAR; return USER_TYPE_REGULAR;
...@@ -924,6 +925,8 @@ void UserManagerBase::RegularUserLoggedIn(const AccountId& account_id, ...@@ -924,6 +925,8 @@ void UserManagerBase::RegularUserLoggedIn(const AccountId& account_id,
base::UTF8ToUTF16(active_user_->GetAccountName(true))); base::UTF8ToUTF16(active_user_->GetAccountName(true)));
known_user::SetProfileEverInitialized( known_user::SetProfileEverInitialized(
active_user_->GetAccountId(), active_user_->profile_ever_initialized()); active_user_->GetAccountId(), active_user_->profile_ever_initialized());
} else {
SaveUserType(active_user_);
} }
AddUserRecord(active_user_); AddUserRecord(active_user_);
......
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