Chromium Code Reviews| Index: chromeos/login/auth/utils.cc |
| diff --git a/chromeos/login/auth/utils.cc b/chromeos/login/auth/utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..157b0c3f4cd240af41aaaf8470f412b069ece305 |
| --- /dev/null |
| +++ b/chromeos/login/auth/utils.cc |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chromeos/login/auth/utils.h" |
| + |
| +#include "base/logging.h" |
|
xiyuan
2016/02/17 23:14:26
not used?
Alexander Alekseev
2016/02/18 13:45:15
Done.
|
| +#include "chromeos/cryptohome/cryptohome_parameters.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| +#include "components/user_manager/known_user.h" |
| + |
| +namespace cryptohome { |
| + |
| +class AccountId GetAccountId(const Identification& user_id) { |
| + const std::vector<AccountId> known_account_ids = |
| + user_manager::known_user::GetKnownAccountIds(); |
| + |
| + for (const AccountId& known_id : known_account_ids) { |
| + if (known_id.GetGaiaIdKey() == user_id.id()) |
| + return known_id; |
| + } |
| + |
| + return user_manager::known_user::GetAccountId(user_id.id(), |
| + std::string() /* gaia_id */); |
| +} |
| + |
| +} // namespace cryptohome |