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

Unified Diff: chromeos/login/auth/utils.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: Better condition in LOG_ASSERT in AccountId. 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: 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..c36e9bdafed8e90369142eb339ce0adc4566db43
--- /dev/null
+++ b/chromeos/login/auth/utils.cc
@@ -0,0 +1,26 @@
+// 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 "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 */);
+}
stevenjb 2016/02/23 19:27:34 This is a strange place to put something in the cr
Alexander Alekseev 2016/02/24 01:52:57 First of all, one of the important steps in this C
stevenjb 2016/02/24 17:25:43 I do not see a single instance of "namespace crypt
Alexander Alekseev 2016/02/25 07:40:46 Done.
+
+} // namespace cryptohome

Powered by Google App Engine
This is Rietveld 408576698