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

Unified Diff: chromeos/login/user_names.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/user_names.cc
diff --git a/chromeos/login/user_names.cc b/chromeos/login/user_names.cc
index 52ed05362e23881db9dc346df670f19346ac9562..f39acd1d055e5b47a45d6b1a37db22020dfdf9f5 100644
--- a/chromeos/login/user_names.cc
+++ b/chromeos/login/user_names.cc
@@ -3,27 +3,45 @@
// found in the LICENSE file.
#include "chromeos/login/user_names.h"
+#include "components/user_manager/user_id.h"
#include "google_apis/gaia/gaia_auth_util.h"
-namespace chromeos {
+namespace {
-namespace login {
+// Should match cros constant in platform/libchromeos/chromeos/cryptohome.h
+const char* kGuestUserName = "$guest";
+
+const char* kSignInUser = "sign-in-user-id";
const char* kStubUser = "stub-user@example.com";
+} // anonymous namespace
-const char* kSignInUser = "sign-in-user-id";
+namespace chromeos {
-// Should match cros constant in platform/libchromeos/chromeos/cryptohome.h
-const char* kGuestUserName = "$guest";
+namespace login {
+
+const char* kLegacyGuestUserName = kGuestUserName;
const char* kSupervisedUserDomain = "locally-managed.localhost";
std::string CanonicalizeUserID(const std::string& user_id) {
- if (user_id == chromeos::login::kGuestUserName)
+ if (user_id == kGuestUserName)
return user_id;
return gaia::CanonicalizeEmail(user_id);
}
+user_manager::UserID GetSignInUserID() {
+ return user_manager::UserID(std::string() /* gaia_id */, kSignInUser);
+}
+
+user_manager::UserID GetGuestUserID() {
+ return user_manager::UserID(std::string() /* gaia_id */, kGuestUserName);
+}
+
+user_manager::UserID GetStubUserID() {
+ return user_manager::UserID(std::string() /* gaia_id */, kStubUser);
+}
+
} // namespace login
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698