Chromium Code Reviews| Index: chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| diff --git a/chrome/browser/ui/ash/multi_user/multi_user_util.cc b/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| index c273936497f34c1a98de094902c66fd42c4c2eea..5e4d80cfc8ce40d01b8046f314a83ffeba8ba471 100644 |
| --- a/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| +++ b/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| @@ -23,6 +23,19 @@ |
| namespace multi_user_util { |
| AccountId GetAccountIdFromProfile(Profile* profile) { |
| +#if defined(OS_CHROMEOS) |
| + // If in a session the refresh token is revoked, GetProfileUserName() might |
| + // returns an empty user email which will cause GetAccountIdFromProfile() |
| + // returns an empty account id, which might cause wired behaviors or crash. |
|
Roger Tawa OOO till Jul 10th
2016/05/05 14:27:20
wired --> weird
xdai1
2016/05/05 18:08:47
Done.
|
| + // Note: If the refresh token is revoked because the user changes his GAIA |
| + // password, we will force log out the user within 120 seconds. See crbug.com/ |
| + // 587318 for more detail. |
| + const user_manager::User* user = |
| + chromeos::ProfileHelper::Get()->GetUserByProfile( |
| + profile->GetOriginalProfile()); |
| + return user ? user->GetAccountId() : EmptyAccountId(); |
| +#endif |
| + |
| return GetAccountIdFromEmail( |
| profile->GetOriginalProfile()->GetProfileUserName()); |
|
Roger Tawa OOO till Jul 10th
2016/05/05 14:27:20
Shouldn't lines 39-40 be wrapped in an #else? Thi
xdai1
2016/05/05 18:08:47
Done. I thought it should be fine to not use a #el
|
| } |
| @@ -48,19 +61,6 @@ Profile* GetProfileFromAccountId(const AccountId& account_id) { |
| return *profile_iterator; |
| } |
| -#if defined(OS_CHROMEOS) |
| - // If in a session the refresh token is revoked, GetAccountIdFromProfile() |
| - // returns an empty account id which will cause the profile not being fetched |
| - // properly. In this case we fall back to use GetProfileByUser() function. |
| - // Note: If the refresh token is revoked because the user changes his GAIA |
| - // password, we will force log out the user within 120 seconds. See crbug.com/ |
| - // 587318 for more detail. |
| - const user_manager::User* user = |
| - user_manager::UserManager::Get()->FindUser(account_id); |
| - if (user) |
| - return chromeos::ProfileHelper::Get()->GetProfileByUser(user); |
| -#endif |
| - |
| return nullptr; |
| } |