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

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: Add 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: 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

Powered by Google App Engine
This is Rietveld 408576698