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 f9b4655402afffdf0233e9f03ae972856083c478..3c7c377579ffd0e8271e18434992e5ad1c316777 100644 |
| --- a/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| +++ b/chrome/browser/ui/ash/multi_user/multi_user_util.cc |
| @@ -15,6 +15,7 @@ |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| #include "components/user_manager/user_manager.h" |
| #endif |
| @@ -36,7 +37,7 @@ AccountId GetAccountIdFromEmail(const std::string& email) { |
| Profile* GetProfileFromAccountId(const AccountId& account_id) { |
| // Unit tests can end up here without a |g_browser_process|. |
| if (!g_browser_process || !g_browser_process->profile_manager()) |
| - return NULL; |
| + return nullptr; |
| std::vector<Profile*> profiles = |
| g_browser_process->profile_manager()->GetLoadedProfiles(); |
| @@ -46,7 +47,18 @@ Profile* GetProfileFromAccountId(const AccountId& account_id) { |
| if (GetAccountIdFromProfile(*profile_iterator) == account_id) |
| return *profile_iterator; |
| } |
| - return NULL; |
| + |
| +#if defined(OS_CHROMEOS) |
| + // If the refresh token is revoked in the session, GetAccountIdFromProfile() |
|
Mr4D (OOO till 08-26)
2016/02/16 20:26:18
Sounds weird. Better:
If in a session the refresh
Alexander Alekseev
2016/02/16 20:34:15
This usually happens when Google account password
xdai1
2016/02/16 21:36:28
Done.
|
| + // returns an empty account id which will cause the profile not being fetched |
| + // properly. In this case we fall back to use GetProfileByUser() function. |
| + const user_manager::User* user = |
| + user_manager::UserManager::Get()->FindUser(account_id); |
| + if (user) |
| + return chromeos::ProfileHelper::Get()->GetProfileByUser(user); |
| +#endif |
| + |
| + return nullptr; |
| } |
| Profile* GetProfileFromWindow(aura::Window* window) { |