| Index: chrome/browser/chromeos/login/user_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
|
| index b9f82e7302dddf7053eba3cdff23efbab0a07d2d..3ced758d212cc56831791b5b0651e48819963f9a 100644
|
| --- a/chrome/browser/chromeos/login/user_manager.cc
|
| +++ b/chrome/browser/chromeos/login/user_manager.cc
|
| @@ -5,7 +5,9 @@
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
|
|
| #include "base/logging.h"
|
| +#include "base/string_util.h"
|
| #include "chrome/browser/chromeos/login/user_manager_impl.h"
|
| +#include "chrome/common/extensions/extension.h"
|
|
|
| namespace chromeos {
|
|
|
| @@ -54,6 +56,28 @@ UserManager* UserManager::SetForTesting(UserManager* user_manager) {
|
| return previous_user_manager;
|
| }
|
|
|
| +// static
|
| +bool UserManager::ParseKioskAppUserId(const std::string& user_id,
|
| + std::string* app_id) {
|
| + const std::string suffix(std::string("@") + kKioskAppUserDomain);
|
| + if (EndsWith(user_id, suffix, false)) {
|
| + const std::string candidate_app_id(
|
| + user_id.substr(0, user_id.size() - suffix.size()));
|
| + if (extensions::Extension::IdIsValid(candidate_app_id)) {
|
| + *app_id = candidate_app_id;
|
| + return true;
|
| + }
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| +// static
|
| +std::string UserManager::FormatKioskAppUserId(const std::string& app_id) {
|
| + DCHECK(extensions::Extension::IdIsValid(app_id));
|
| + return app_id + '@' + kKioskAppUserDomain;
|
| +}
|
| +
|
| ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager)
|
| : previous_user_manager_(UserManager::SetForTesting(user_manager)) {
|
| }
|
|
|