Chromium Code Reviews| 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" |
| 11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
| 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 13 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | |
| 13 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 14 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 14 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 15 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 15 #include "chrome/browser/chromeos/login/login_utils.h" | 16 #include "chrome/browser/chromeos/login/login_utils.h" |
| 16 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
| 17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 18 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
| 19 #include "chromeos/cryptohome/async_method_caller.h" | 20 #include "chromeos/cryptohome/async_method_caller.h" |
| 20 #include "chromeos/dbus/cryptohome_client.h" | 21 #include "chromeos/dbus/cryptohome_client.h" |
| 21 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 if (error != KioskAppLaunchError::NONE) { | 143 if (error != KioskAppLaunchError::NONE) { |
| 143 delegate_->OnProfileLoadFailed(error); | 144 delegate_->OnProfileLoadFailed(error); |
| 144 } | 145 } |
| 145 } | 146 } |
| 146 | 147 |
| 147 void KioskProfileLoader::OnLoginSuccess(const UserContext& user_context) { | 148 void KioskProfileLoader::OnLoginSuccess(const UserContext& user_context) { |
| 148 // LoginPerformer will delete itself. | 149 // LoginPerformer will delete itself. |
| 149 login_performer_->set_delegate(NULL); | 150 login_performer_->set_delegate(NULL); |
| 150 ignore_result(login_performer_.release()); | 151 ignore_result(login_performer_.release()); |
| 151 | 152 |
| 152 LoginUtils::Get()->PrepareProfile(user_context, | 153 UserContext context = user_context; |
| 154 if (context.username == UserManager::kGuestUserName) | |
|
Dmitry Polukhin
2014/02/20 00:02:48
Please add comment why you do this substitution.
rkc
2014/02/20 00:05:38
Done.
| |
| 155 context.username = DemoAppLauncher::kDemoUserName; | |
| 156 LoginUtils::Get()->PrepareProfile(context, | |
| 153 std::string(), // display email | 157 std::string(), // display email |
| 154 false, // has_cookies | 158 false, // has_cookies |
| 155 false, // has_active_session | 159 false, // has_active_session |
| 156 this); | 160 this); |
| 157 } | 161 } |
| 158 | 162 |
| 159 void KioskProfileLoader::OnLoginFailure(const LoginFailure& error) { | 163 void KioskProfileLoader::OnLoginFailure(const LoginFailure& error) { |
| 160 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); | 164 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); |
| 161 } | 165 } |
| 162 | 166 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 176 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { | 180 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { |
| 177 // This object could be deleted any time after successfully reporting | 181 // This object could be deleted any time after successfully reporting |
| 178 // a profile load, so invalidate the LoginUtils delegate now. | 182 // a profile load, so invalidate the LoginUtils delegate now. |
| 179 LoginUtils::Get()->DelegateDeleted(this); | 183 LoginUtils::Get()->DelegateDeleted(this); |
| 180 | 184 |
| 181 delegate_->OnProfileLoaded(profile); | 185 delegate_->OnProfileLoaded(profile); |
| 182 ReportLaunchResult(KioskAppLaunchError::NONE); | 186 ReportLaunchResult(KioskAppLaunchError::NONE); |
| 183 } | 187 } |
| 184 | 188 |
| 185 } // namespace chromeos | 189 } // namespace chromeos |
| OLD | NEW |