Chromium Code Reviews| 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 "components/user_manager/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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 FixedAccountManager::FixedAccountManager() | 47 FixedAccountManager::FixedAccountManager() |
| 48 : stub_account_id_(AccountId::FromUserEmail(user_manager::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_(AccountId::FromUserEmail(user_manager::kGuestUserName)), | 50 guest_account_id_(AccountId::FromUserEmail(user_manager::kGuestUserName)), |
| 51 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} | 51 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 namespace user_manager { | 55 namespace user_manager { |
| 56 | 56 |
| 57 constexpr const char kStubUser[] = "stub-user@example.com"; | 57 const char kStubUser[] = "stub-user@example.com"; |
| 58 | 58 |
| 59 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h | 59 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h |
| 60 constexpr const char kGuestUserName[] = "$guest"; | 60 const char kGuestUserName[] = "$guest"; |
| 61 | 61 |
| 62 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; | 62 const char kSupervisedUserDomain[] = "locally-managed.localhost"; |
| 63 | |
| 64 // StubAccountId is used for all tests, not only ChromeOS | |
| 65 const AccountId& StubAccountId() { | |
|
xiyuan
2016/10/28 16:40:59
nit: move this back to before "SigninAccountId()"
Alexander Alekseev
2016/10/31 21:31:01
Done.
| |
| 66 return FixedAccountManager::GetInstance()->stub_account_id(); | |
| 67 } | |
| 63 | 68 |
| 64 std::string CanonicalizeUserID(const std::string& user_id) { | 69 std::string CanonicalizeUserID(const std::string& user_id) { |
| 65 if (user_id == kGuestUserName) | 70 if (user_id == kGuestUserName) |
| 66 return user_id; | 71 return user_id; |
| 67 return gaia::CanonicalizeEmail(user_id); | 72 return gaia::CanonicalizeEmail(user_id); |
| 68 } | 73 } |
| 69 | 74 |
| 70 const AccountId& StubAccountId() { | |
| 71 return FixedAccountManager::GetInstance()->stub_account_id(); | |
| 72 } | |
| 73 | |
| 74 const AccountId& SignInAccountId() { | 75 const AccountId& SignInAccountId() { |
| 75 return FixedAccountManager::GetInstance()->signin_account_id(); | 76 return FixedAccountManager::GetInstance()->signin_account_id(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 const AccountId& GuestAccountId() { | 79 const AccountId& GuestAccountId() { |
| 79 return FixedAccountManager::GetInstance()->guest_account_id(); | 80 return FixedAccountManager::GetInstance()->guest_account_id(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 const AccountId& DemoAccountId() { | 83 const AccountId& DemoAccountId() { |
| 83 return FixedAccountManager::GetInstance()->demo_account_id(); | 84 return FixedAccountManager::GetInstance()->demo_account_id(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace user_manager | 87 } // namespace user_manager |
| OLD | NEW |