Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc

Issue 14927015: Translate device-local account IDs to user IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser_tests. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc b/chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc
index f5a760a82d62f08af34b4039062e2f560c123ca6..b0ff3ce9a8aca7dc6418554c1c503550c63a8245 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_launcher.cc
@@ -8,10 +8,12 @@
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
+#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
#include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
#include "chrome/browser/chromeos/login/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/ui/app_launch_view.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chromeos/cryptohome/async_method_caller.h"
@@ -26,10 +28,6 @@ namespace chromeos {
namespace {
-std::string GetAppUserNameFromAppId(const std::string& app_id) {
- return app_id + "@" + UserManager::kKioskAppUserDomain;
-}
-
} // namespace
Joao da Silva 2013/05/17 18:10:55 nit: The empty namespace { } can be removed
bartfab (slow) 2013/05/21 13:27:07 Done.
// static
@@ -105,8 +103,13 @@ class KioskAppLauncher::CryptohomedChecker
class KioskAppLauncher::ProfileLoader : public LoginUtils::Delegate {
public:
- explicit ProfileLoader(KioskAppLauncher* launcher)
- : launcher_(launcher) {
+ ProfileLoader(KioskAppManager* kiosk_app_manager,
+ KioskAppLauncher* kiosk_app_launcher)
+ : kiosk_app_launcher_(kiosk_app_launcher) {
+ KioskAppManager::App app;
+ if (!kiosk_app_manager->GetApp(kiosk_app_launcher->app_id_, &app))
+ NOTREACHED() << "Logging into nonexistent kiosk-app account.";
+ user_id_ = app.user_id;
}
virtual ~ProfileLoader() {
@@ -115,7 +118,7 @@ class KioskAppLauncher::ProfileLoader : public LoginUtils::Delegate {
void Start() {
cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername(
- GetAppUserNameFromAppId(launcher_->app_id_),
+ user_id_,
base::Bind(&ProfileLoader::OnUsernameHashRetrieved,
base::Unretained(this)));
}
@@ -124,14 +127,14 @@ class KioskAppLauncher::ProfileLoader : public LoginUtils::Delegate {
void OnUsernameHashRetrieved(bool success,
const std::string& username_hash) {
if (!success) {
- LOG(ERROR) << "Unable to retrieve username hash for user '" <<
- GetAppUserNameFromAppId(launcher_->app_id_) << "'";
- launcher_->ReportLaunchResult(
+ LOG(ERROR) << "Unable to retrieve username hash for user '" << user_id_
+ << "'.";
+ kiosk_app_launcher_->ReportLaunchResult(
KioskAppLaunchError::UNABLE_TO_RETRIEVE_HASH);
return;
}
LoginUtils::Get()->PrepareProfile(
- UserContext(GetAppUserNameFromAppId(launcher_->app_id_),
+ UserContext(user_id_,
std::string(), // password
std::string(), // auth_code
username_hash),
@@ -143,18 +146,22 @@ class KioskAppLauncher::ProfileLoader : public LoginUtils::Delegate {
// LoginUtils::Delegate overrides:
virtual void OnProfilePrepared(Profile* profile) OVERRIDE {
- launcher_->OnProfilePrepared(profile);
+ kiosk_app_launcher_->OnProfilePrepared(profile);
}
- KioskAppLauncher* launcher_;
+ KioskAppLauncher* kiosk_app_launcher_;
+ std::string user_id_;
+
DISALLOW_COPY_AND_ASSIGN(ProfileLoader);
};
////////////////////////////////////////////////////////////////////////////////
// KioskAppLauncher
-KioskAppLauncher::KioskAppLauncher(const std::string& app_id)
- : app_id_(app_id),
+KioskAppLauncher::KioskAppLauncher(KioskAppManager* kiosk_app_manager,
+ const std::string& app_id)
+ : kiosk_app_manager_(kiosk_app_manager),
+ app_id_(app_id),
remove_attempted_(false) {
}
@@ -210,7 +217,7 @@ void KioskAppLauncher::StartMount() {
void KioskAppLauncher::MountCallback(bool mount_success,
cryptohome::MountError mount_error) {
if (mount_success) {
- profile_loader_.reset(new ProfileLoader(this));
+ profile_loader_.reset(new ProfileLoader(kiosk_app_manager_, this));
profile_loader_->Start();
return;
}

Powered by Google App Engine
This is Rietveld 408576698