| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/app_mode/kiosk_profile_loader.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 KioskProfileLoader* loader_; | 108 KioskProfileLoader* loader_; |
| 109 int retry_count_; | 109 int retry_count_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(CryptohomedChecker); | 111 DISALLOW_COPY_AND_ASSIGN(CryptohomedChecker); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 | 114 |
| 115 //////////////////////////////////////////////////////////////////////////////// | 115 //////////////////////////////////////////////////////////////////////////////// |
| 116 // KioskProfileLoader | 116 // KioskProfileLoader |
| 117 | 117 |
| 118 KioskProfileLoader::KioskProfileLoader(KioskAppManager* kiosk_app_manager, | 118 KioskProfileLoader::KioskProfileLoader(const std::string& app_user_id, |
| 119 const std::string& app_id, | 119 bool force_ephemeral, |
| 120 Delegate* delegate) | 120 Delegate* delegate) |
| 121 : kiosk_app_manager_(kiosk_app_manager), | 121 : user_id_(app_user_id), |
| 122 app_id_(app_id), | 122 force_ephemeral_(force_ephemeral), |
| 123 delegate_(delegate) { | 123 delegate_(delegate) {} |
| 124 KioskAppManager::App app; | |
| 125 CHECK(kiosk_app_manager_->GetApp(app_id_, &app)); | |
| 126 user_id_ = app.user_id; | |
| 127 } | |
| 128 | 124 |
| 129 KioskProfileLoader::~KioskProfileLoader() {} | 125 KioskProfileLoader::~KioskProfileLoader() {} |
| 130 | 126 |
| 131 void KioskProfileLoader::Start() { | 127 void KioskProfileLoader::Start() { |
| 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 133 login_performer_.reset(); | 129 login_performer_.reset(); |
| 134 cryptohomed_checker_.reset(new CryptohomedChecker(this)); | 130 cryptohomed_checker_.reset(new CryptohomedChecker(this)); |
| 135 cryptohomed_checker_->StartCheck(); | 131 cryptohomed_checker_->StartCheck(); |
| 136 } | 132 } |
| 137 | 133 |
| 138 void KioskProfileLoader::LoginAsKioskAccount() { | 134 void KioskProfileLoader::LoginAsKioskAccount() { |
| 139 login_performer_.reset(new LoginPerformer(this)); | 135 login_performer_.reset(new LoginPerformer(this)); |
| 140 login_performer_->LoginAsKioskAccount(user_id_); | 136 login_performer_->LoginAsKioskAccount(user_id_, force_ephemeral_); |
| 141 } | 137 } |
| 142 | 138 |
| 143 void KioskProfileLoader::ReportLaunchResult(KioskAppLaunchError::Error error) { | 139 void KioskProfileLoader::ReportLaunchResult(KioskAppLaunchError::Error error) { |
| 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 145 | 141 |
| 146 if (error != KioskAppLaunchError::NONE) { | 142 if (error != KioskAppLaunchError::NONE) { |
| 147 delegate_->OnProfileLoadFailed(error); | 143 delegate_->OnProfileLoadFailed(error); |
| 148 } | 144 } |
| 149 } | 145 } |
| 150 | 146 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { | 176 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { |
| 181 // This object could be deleted any time after successfully reporting | 177 // This object could be deleted any time after successfully reporting |
| 182 // a profile load, so invalidate the LoginUtils delegate now. | 178 // a profile load, so invalidate the LoginUtils delegate now. |
| 183 LoginUtils::Get()->DelegateDeleted(this); | 179 LoginUtils::Get()->DelegateDeleted(this); |
| 184 | 180 |
| 185 delegate_->OnProfileLoaded(profile); | 181 delegate_->OnProfileLoaded(profile); |
| 186 ReportLaunchResult(KioskAppLaunchError::NONE); | 182 ReportLaunchResult(KioskAppLaunchError::NONE); |
| 187 } | 183 } |
| 188 | 184 |
| 189 } // namespace chromeos | 185 } // namespace chromeos |
| OLD | NEW |