OLD | NEW |
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 "components/user_manager/user_names.h" |
5 | 5 |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "components/signin/core/account_id/account_id.h" | 8 #include "components/signin/core/account_id/account_id.h" |
9 #include "google_apis/gaia/gaia_auth_util.h" | 9 #include "google_apis/gaia/gaia_auth_util.h" |
10 | 10 |
11 class AccountId; | 11 class AccountId; |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
(...skipping 23 matching lines...) Expand all Loading... |
38 | 38 |
39 const AccountId stub_account_id_; | 39 const AccountId stub_account_id_; |
40 const AccountId signin_account_id_; | 40 const AccountId signin_account_id_; |
41 const AccountId guest_account_id_; | 41 const AccountId guest_account_id_; |
42 const AccountId demo_account_id_; | 42 const AccountId demo_account_id_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(FixedAccountManager); | 44 DISALLOW_COPY_AND_ASSIGN(FixedAccountManager); |
45 }; | 45 }; |
46 | 46 |
47 FixedAccountManager::FixedAccountManager() | 47 FixedAccountManager::FixedAccountManager() |
48 : stub_account_id_(AccountId::FromUserEmail(chromeos::login::kStubUser)), | 48 : stub_account_id_( |
| 49 AccountId::FromUserEmail(user_manager::chromeos::kStubUser)), |
49 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), | 50 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), |
50 guest_account_id_( | 51 guest_account_id_( |
51 AccountId::FromUserEmail(chromeos::login::kGuestUserName)), | 52 AccountId::FromUserEmail(user_manager::chromeos::kGuestUserName)), |
52 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} | 53 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} |
53 | 54 |
54 } // namespace | 55 } // namespace |
55 | 56 |
| 57 namespace user_manager { |
56 namespace chromeos { | 58 namespace chromeos { |
57 | 59 |
58 namespace login { | |
59 | |
60 constexpr const char kStubUser[] = "stub-user@example.com"; | 60 constexpr const char kStubUser[] = "stub-user@example.com"; |
61 | 61 |
62 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h | 62 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h |
63 constexpr const char kGuestUserName[] = "$guest"; | 63 constexpr const char kGuestUserName[] = "$guest"; |
64 | 64 |
65 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; | 65 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; |
66 | 66 |
67 std::string CanonicalizeUserID(const std::string& user_id) { | 67 std::string CanonicalizeUserID(const std::string& user_id) { |
68 if (user_id == chromeos::login::kGuestUserName) | 68 if (user_id == chromeos::kGuestUserName) |
69 return user_id; | 69 return user_id; |
70 return gaia::CanonicalizeEmail(user_id); | 70 return gaia::CanonicalizeEmail(user_id); |
71 } | 71 } |
72 | 72 |
73 const AccountId& StubAccountId() { | 73 const AccountId& StubAccountId() { |
74 return FixedAccountManager::GetInstance()->stub_account_id(); | 74 return FixedAccountManager::GetInstance()->stub_account_id(); |
75 } | 75 } |
76 | 76 |
77 const AccountId& SignInAccountId() { | 77 const AccountId& SignInAccountId() { |
78 return FixedAccountManager::GetInstance()->signin_account_id(); | 78 return FixedAccountManager::GetInstance()->signin_account_id(); |
79 } | 79 } |
80 | 80 |
81 const AccountId& GuestAccountId() { | 81 const AccountId& GuestAccountId() { |
82 return FixedAccountManager::GetInstance()->guest_account_id(); | 82 return FixedAccountManager::GetInstance()->guest_account_id(); |
83 } | 83 } |
84 | 84 |
85 const AccountId& DemoAccountId() { | 85 const AccountId& DemoAccountId() { |
86 return FixedAccountManager::GetInstance()->demo_account_id(); | 86 return FixedAccountManager::GetInstance()->demo_account_id(); |
87 } | 87 } |
88 | 88 |
89 } // namespace login | |
90 | |
91 } // namespace chromeos | 89 } // namespace chromeos |
| 90 } // namespace user_manager |
OLD | NEW |