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 |
10 #if defined(OS_CHROMEOS) | |
11 #include "google_apis/gaia/gaia_auth_util.h" // nogncheck | |
xiyuan
2016/10/27 18:25:59
Should we fix the deps in BUILD.gn instead of this
Alexander Alekseev
2016/10/28 11:10:25
Done.
| |
12 #endif // OS_CHROMEOS | |
10 | 13 |
11 class AccountId; | 14 class AccountId; |
12 | 15 |
13 namespace { | 16 namespace { |
14 | 17 |
15 // Username for Demo session user. | 18 // Username for Demo session user. |
16 constexpr const char kDemoUserName[] = "demouser@demo.app.local"; | 19 constexpr const char kDemoUserName[] = "demouser@demo.app.local"; |
17 | 20 |
18 // Username for Signin account id. | 21 // Username for Signin account id. |
19 constexpr const char kSignInUser[] = "sign-in-user-id"; | 22 constexpr const char kSignInUser[] = "sign-in-user-id"; |
(...skipping 29 matching lines...) Expand all Loading... | |
49 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), | 52 signin_account_id_(AccountId::FromUserEmail(kSignInUser)), |
50 guest_account_id_(AccountId::FromUserEmail(user_manager::kGuestUserName)), | 53 guest_account_id_(AccountId::FromUserEmail(user_manager::kGuestUserName)), |
51 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} | 54 demo_account_id_(AccountId::FromUserEmail(kDemoUserName)) {} |
52 | 55 |
53 } // namespace | 56 } // namespace |
54 | 57 |
55 namespace user_manager { | 58 namespace user_manager { |
56 | 59 |
57 constexpr const char kStubUser[] = "stub-user@example.com"; | 60 constexpr const char kStubUser[] = "stub-user@example.com"; |
58 | 61 |
62 #if defined(OS_CHROMEOS) | |
59 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h | 63 // Should match cros constant in platform/libchromeos/chromeos/cryptohome.h |
60 constexpr const char kGuestUserName[] = "$guest"; | 64 constexpr const char kGuestUserName[] = "$guest"; |
61 | 65 |
62 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; | 66 constexpr const char kSupervisedUserDomain[] = "locally-managed.localhost"; |
67 #endif // OS_CHROMEOS | |
63 | 68 |
69 // StubAccountId is used for all tests, not only ChromeOS | |
70 const AccountId& StubAccountId() { | |
71 return FixedAccountManager::GetInstance()->stub_account_id(); | |
72 } | |
73 | |
74 #if defined(OS_CHROMEOS) | |
64 std::string CanonicalizeUserID(const std::string& user_id) { | 75 std::string CanonicalizeUserID(const std::string& user_id) { |
65 if (user_id == kGuestUserName) | 76 if (user_id == kGuestUserName) |
66 return user_id; | 77 return user_id; |
67 return gaia::CanonicalizeEmail(user_id); | 78 return gaia::CanonicalizeEmail(user_id); |
68 } | 79 } |
69 | 80 |
70 const AccountId& StubAccountId() { | |
71 return FixedAccountManager::GetInstance()->stub_account_id(); | |
72 } | |
73 | |
74 const AccountId& SignInAccountId() { | 81 const AccountId& SignInAccountId() { |
75 return FixedAccountManager::GetInstance()->signin_account_id(); | 82 return FixedAccountManager::GetInstance()->signin_account_id(); |
76 } | 83 } |
77 | 84 |
78 const AccountId& GuestAccountId() { | 85 const AccountId& GuestAccountId() { |
79 return FixedAccountManager::GetInstance()->guest_account_id(); | 86 return FixedAccountManager::GetInstance()->guest_account_id(); |
80 } | 87 } |
81 | 88 |
82 const AccountId& DemoAccountId() { | 89 const AccountId& DemoAccountId() { |
83 return FixedAccountManager::GetInstance()->demo_account_id(); | 90 return FixedAccountManager::GetInstance()->demo_account_id(); |
84 } | 91 } |
92 #endif // OS_CHROMEOS | |
85 | 93 |
86 } // namespace user_manager | 94 } // namespace user_manager |
OLD | NEW |