Chromium Code Reviews| Index: chrome/browser/chromeos/policy/device_local_account.cc |
| diff --git a/chrome/browser/chromeos/policy/device_local_account.cc b/chrome/browser/chromeos/policy/device_local_account.cc |
| index 2ad53ead08d131f0510cff9c9f137c649213851f..547dab238b2e33d67d4fc87d37dedd51f7baa103 100644 |
| --- a/chrome/browser/chromeos/policy/device_local_account.cc |
| +++ b/chrome/browser/chromeos/policy/device_local_account.cc |
| @@ -6,6 +6,7 @@ |
| #include <set> |
| +#include "base/basictypes.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/strings/string_number_conversions.h" |
| @@ -56,16 +57,29 @@ std::string GenerateDeviceLocalAccountUserId(const std::string& account_id, |
| domain_prefix + kDeviceLocalAccountDomainSuffix); |
| } |
| -bool IsDeviceLocalAccountUser(const std::string& user_id) { |
| - return EndsWith(gaia::ExtractDomainName(user_id), |
| - kDeviceLocalAccountDomainSuffix, |
| - true); |
| -} |
| +bool IsDeviceLocalAccountUser(const std::string& user_id, |
| + DeviceLocalAccount::Type* type) { |
| + const std::string domain = gaia::ExtractDomainName(user_id); |
| + if (!EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) |
| + return false; |
| + |
| + const std::string domain_prefix = domain.substr( |
| + 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1); |
| + |
| + if (domain_prefix == kPublicAccountDomainPrefix) { |
| + if (type) |
| + *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION; |
| + return true; |
| + } |
| + if (domain_prefix == kKioskAppAccountDomainPrefix) { |
| + if (type) |
| + *type = DeviceLocalAccount::TYPE_KIOSK_APP; |
| + return true; |
| + } |
| -bool IsKioskAppUser(const std::string& user_id) { |
| - return gaia::ExtractDomainName(user_id) == |
| - std::string(kKioskAppAccountDomainPrefix) + |
| - kDeviceLocalAccountDomainSuffix; |
| + // |user_id| is a device-local account but its type is not recognized. |
| + NOTREACHED(); |
|
pastarmovj
2013/10/02 14:44:50
I think it will be still good to set |type| to som
bartfab (slow)
2013/10/02 14:48:35
Done.
|
| + return true; |
| } |
| void SetDeviceLocalAccounts( |