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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "chromeos/login/user_names.h" 4 #include "chromeos/login/user_names.h"
5 5
6 #include "components/user_manager/user_id.h"
6 #include "google_apis/gaia/gaia_auth_util.h" 7 #include "google_apis/gaia/gaia_auth_util.h"
7 8
9 namespace {
10
11 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h
12 const char* kGuestUserName = "$guest";
13
14 const char* kSignInUser = "sign-in-user-id";
15
16 const char* kStubUser = "stub-user@example.com";
17 } // anonymous namespace
18
8 namespace chromeos { 19 namespace chromeos {
9 20
10 namespace login { 21 namespace login {
11 22
12 const char* kStubUser = "stub-user@example.com"; 23 const char* kLegacyGuestUserName = kGuestUserName;
13
14 const char* kSignInUser = "sign-in-user-id";
15
16 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h
17 const char* kGuestUserName = "$guest";
18 24
19 const char* kSupervisedUserDomain = "locally-managed.localhost"; 25 const char* kSupervisedUserDomain = "locally-managed.localhost";
20 26
21 std::string CanonicalizeUserID(const std::string& user_id) { 27 std::string CanonicalizeUserID(const std::string& user_id) {
22 if (user_id == chromeos::login::kGuestUserName) 28 if (user_id == kGuestUserName)
23 return user_id; 29 return user_id;
24 return gaia::CanonicalizeEmail(user_id); 30 return gaia::CanonicalizeEmail(user_id);
25 } 31 }
26 32
33 user_manager::UserID GetSignInUserID() {
34 return user_manager::UserID(std::string() /* gaia_id */, kSignInUser);
35 }
36
37 user_manager::UserID GetGuestUserID() {
38 return user_manager::UserID(std::string() /* gaia_id */, kGuestUserName);
39 }
40
41 user_manager::UserID GetStubUserID() {
42 return user_manager::UserID(std::string() /* gaia_id */, kStubUser);
43 }
44
27 } // namespace login 45 } // namespace login
28 46
29 } // namespace chromeos 47 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698