| 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_(AccountId::FromUserEmail(user_manager::kStubUser)), |
| 49 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), | 49 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), |
| 50 guest_account_id_( | 50 guest_account_id_(AccountId::FromUserEmail(user_manager::kGuestUserName)), |
| 51 AccountId::FromUserEmail(chromeos::login::kGuestUserName)), | |
| 52 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} | 51 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} |
| 53 | 52 |
| 54 } // namespace | 53 } // namespace |
| 55 | 54 |
| 56 namespace chromeos { | 55 namespace user_manager { |
| 57 | |
| 58 namespace login { | |
| 59 | 56 |
| 60 constexpr const char kStubUser[] = "stub-user@example.com"; | 57 constexpr const char kStubUser[] = "stub-user@example.com"; |
| 61 | 58 |
| 62 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h | 59 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h |
| 63 constexpr const char kGuestUserName[] = "$guest"; | 60 constexpr const char kGuestUserName[] = "$guest"; |
| 64 | 61 |
| 65 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; | 62 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; |
| 66 | 63 |
| 67 std::string CanonicalizeUserID(const std::string& user_id) { | 64 std::string CanonicalizeUserID(const std::string& user_id) { |
| 68 if (user_id == chromeos::login::kGuestUserName) | 65 if (user_id == kGuestUserName) |
| 69 return user_id; | 66 return user_id; |
| 70 return gaia::CanonicalizeEmail(user_id); | 67 return gaia::CanonicalizeEmail(user_id); |
| 71 } | 68 } |
| 72 | 69 |
| 73 const AccountId& StubAccountId() { | 70 const AccountId& StubAccountId() { |
| 74 return FixedAccountManager::GetInstance()->stub_account_id(); | 71 return FixedAccountManager::GetInstance()->stub_account_id(); |
| 75 } | 72 } |
| 76 | 73 |
| 77 const AccountId& SignInAccountId() { | 74 const AccountId& SignInAccountId() { |
| 78 return FixedAccountManager::GetInstance()->signin_account_id(); | 75 return FixedAccountManager::GetInstance()->signin_account_id(); |
| 79 } | 76 } |
| 80 | 77 |
| 81 const AccountId& GuestAccountId() { | 78 const AccountId& GuestAccountId() { |
| 82 return FixedAccountManager::GetInstance()->guest_account_id(); | 79 return FixedAccountManager::GetInstance()->guest_account_id(); |
| 83 } | 80 } |
| 84 | 81 |
| 85 const AccountId& DemoAccountId() { | 82 const AccountId& DemoAccountId() { |
| 86 return FixedAccountManager::GetInstance()->demo_account_id(); | 83 return FixedAccountManager::GetInstance()->demo_account_id(); |
| 87 } | 84 } |
| 88 | 85 |
| 89 } // namespace login | 86 } // namespace user_manager |
| 90 | |
| 91 } // namespace chromeos | |
| OLD | NEW |