Chromium Code Reviews| Index: components/user_manager/user_manager.cc |
| diff --git a/components/user_manager/user_manager.cc b/components/user_manager/user_manager.cc |
| index 3cf3f267993afb3721fe6531127a583634d6c657..869b36644c38bf5c0295492efaefa76708dff868 100644 |
| --- a/components/user_manager/user_manager.cc |
| +++ b/components/user_manager/user_manager.cc |
| @@ -5,6 +5,8 @@ |
| #include "components/user_manager/user_manager.h" |
| #include "base/logging.h" |
| +#include "chromeos/login/user_names.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| namespace user_manager { |
| @@ -85,4 +87,27 @@ UserManager* UserManager::SetForTesting(UserManager* user_manager) { |
| return previous_instance; |
| } |
| +// static |
| +AccountId UserManager::GetKnownUserAccountId(const std::string& user_email, |
| + const std::string& gaia_id) { |
| + // In tests empty accounts are possible. |
| + if (user_email.empty() && gaia_id.empty()) |
| + return EmptyAccountId(); |
| + |
| + if (user_email == chromeos::login::kStubUser) |
| + return chromeos::login::StubAccountId(); |
| + |
| + if (user_email == chromeos::login::kGuestUserName) |
| + return chromeos::login::GuestAccountId(); |
| + |
| + UserManager* user_manager = Get(); |
| + if (user_manager) |
| + return user_manager->GetKnownUserAccountIdImpl(user_email, gaia_id); |
| + |
| + // This is fallback for tests. |
| + return (gaia_id.empty() |
|
achuithb
2015/11/23 22:26:10
Is this the right formatting? Shouldn't it be:
gai
Alexander Alekseev
2015/11/24 04:26:54
This is the result of recent clang-format.
|
| + ? AccountId::FromUserEmail(user_email) |
| + : AccountId::FromUserEmailGaiaId(user_email, gaia_id)); |
| +} |
| + |
| } // namespace user_manager |