OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 | 4 |
5 #include "chrome/browser/chromeos/policy/device_local_account.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 domain_prefix + kDeviceLocalAccountDomainSuffix); | 61 domain_prefix + kDeviceLocalAccountDomainSuffix); |
62 } | 62 } |
63 | 63 |
64 bool IsDeviceLocalAccountUser(const std::string& user_id, | 64 bool IsDeviceLocalAccountUser(const std::string& user_id, |
65 DeviceLocalAccount::Type* type) { | 65 DeviceLocalAccount::Type* type) { |
66 // For historical reasons, the guest user ID does not contain an @ symbol and | 66 // For historical reasons, the guest user ID does not contain an @ symbol and |
67 // therefore, cannot be parsed by gaia::ExtractDomainName(). | 67 // therefore, cannot be parsed by gaia::ExtractDomainName(). |
68 if (user_id == chromeos::login::kGuestUserName) | 68 if (user_id == chromeos::login::kGuestUserName) |
69 return false; | 69 return false; |
70 const std::string domain = gaia::ExtractDomainName(user_id); | 70 const std::string domain = gaia::ExtractDomainName(user_id); |
71 if (!EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) | 71 if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) |
72 return false; | 72 return false; |
73 | 73 |
74 const std::string domain_prefix = domain.substr( | 74 const std::string domain_prefix = domain.substr( |
75 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1); | 75 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1); |
76 | 76 |
77 if (domain_prefix == kPublicAccountDomainPrefix) { | 77 if (domain_prefix == kPublicAccountDomainPrefix) { |
78 if (type) | 78 if (type) |
79 *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION; | 79 *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION; |
80 return true; | 80 return true; |
81 } | 81 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 accounts.push_back( | 180 accounts.push_back( |
181 DeviceLocalAccount(static_cast<DeviceLocalAccount::Type>(type), | 181 DeviceLocalAccount(static_cast<DeviceLocalAccount::Type>(type), |
182 account_id, | 182 account_id, |
183 kiosk_app_id, | 183 kiosk_app_id, |
184 kiosk_app_update_url)); | 184 kiosk_app_update_url)); |
185 } | 185 } |
186 return accounts; | 186 return accounts; |
187 } | 187 } |
188 | 188 |
189 } // namespace policy | 189 } // namespace policy |
OLD | NEW |