Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: components/user_manager/known_user.cc

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing files. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/user_manager/known_user.cc
diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc
index 973e12b78ee890d584ccda602932cc6682207af4..84634fafc6f5f9d5e82e07485e5a4f989a07fa4c 100644
--- a/components/user_manager/known_user.cc
+++ b/components/user_manager/known_user.cc
@@ -256,6 +256,30 @@ AccountId GetAccountId(const std::string& user_email,
: AccountId::FromUserEmailGaiaId(user_email, gaia_id));
}
+std::vector<AccountId> GetKnownAccountIds() {
+ std::vector<AccountId> result;
+ PrefService* local_state = GetLocalState();
+
+ // Local State may not be initialized in tests.
+ if (!local_state)
+ return result;
+
+ const base::ListValue* known_users = local_state->GetList(kKnownUsers);
+ for (size_t i = 0; i < known_users->GetSize(); ++i) {
+ const base::DictionaryValue* element = nullptr;
+ if (known_users->GetDictionary(i, &element)) {
+ std::string email;
+ std::string gaia_id;
+ const bool has_email = element->GetString(kCanonicalEmail, &email);
+ const bool has_gaia_id = element->GetString(kGAIAIdKey, &gaia_id);
+ if (has_email || has_gaia_id) {
dzhioev (left Google) 2016/02/20 07:15:13 No need for {}
dzhioev (left Google) 2016/02/20 07:15:13 when this condition is false?
Alexander Alekseev 2016/02/20 08:07:11 Done.
Alexander Alekseev 2016/02/20 08:07:11 When data is corrupt.
+ result.push_back(AccountId::FromUserEmailGaiaId(email, gaia_id));
+ }
+ }
+ }
+ return result;
+}
+
bool GetGaiaIdMigrationStatus(const AccountId& account_id,
const std::string& subsystem) {
bool migrated = false;
« chromeos/login/auth/cryptohome_authenticator.cc ('K') | « components/user_manager/known_user.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698