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; |