| 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/auth/login_status_consumer.h" | 13 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" |
| 14 #include "chrome/browser/chromeos/login/auth/user_context.h" | |
| 15 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 14 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 16 #include "chrome/browser/chromeos/login/login_utils.h" | 15 #include "chrome/browser/chromeos/login/login_utils.h" |
| 17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 18 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 20 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
| 21 #include "chromeos/cryptohome/async_method_caller.h" | 19 #include "chromeos/cryptohome/async_method_caller.h" |
| 22 #include "chromeos/dbus/cryptohome_client.h" | 20 #include "chromeos/dbus/cryptohome_client.h" |
| 23 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/login/auth/user_context.h" |
| 23 #include "chromeos/login/user_names.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "google_apis/gaia/gaia_auth_util.h" | 25 #include "google_apis/gaia/gaia_auth_util.h" |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 KioskAppLaunchError::Error LoginFailureToKioskAppLaunchError( | 33 KioskAppLaunchError::Error LoginFailureToKioskAppLaunchError( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // LoginPerformer will delete itself. | 150 // LoginPerformer will delete itself. |
| 151 login_performer_->set_delegate(NULL); | 151 login_performer_->set_delegate(NULL); |
| 152 ignore_result(login_performer_.release()); | 152 ignore_result(login_performer_.release()); |
| 153 | 153 |
| 154 // If we are launching a demo session, we need to start MountGuest with the | 154 // If we are launching a demo session, we need to start MountGuest with the |
| 155 // guest username; this is because there are several places in the cros code | 155 // guest username; this is because there are several places in the cros code |
| 156 // which rely on the username sent to cryptohome to be $guest. Back in Chrome | 156 // which rely on the username sent to cryptohome to be $guest. Back in Chrome |
| 157 // we switch this back to the demo user name to correctly identify this | 157 // we switch this back to the demo user name to correctly identify this |
| 158 // user as a demo user. | 158 // user as a demo user. |
| 159 UserContext context = user_context; | 159 UserContext context = user_context; |
| 160 if (context.GetUserID() == UserManager::kGuestUserName) | 160 if (context.GetUserID() == chromeos::login::kGuestUserName) |
| 161 context.SetUserID(DemoAppLauncher::kDemoUserName); | 161 context.SetUserID(DemoAppLauncher::kDemoUserName); |
| 162 LoginUtils::Get()->PrepareProfile(context, | 162 LoginUtils::Get()->PrepareProfile(context, |
| 163 false, // has_auth_cookies | 163 false, // has_auth_cookies |
| 164 false, // has_active_session | 164 false, // has_active_session |
| 165 this); | 165 this); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void KioskProfileLoader::OnLoginFailure(const LoginFailure& error) { | 168 void KioskProfileLoader::OnLoginFailure(const LoginFailure& error) { |
| 169 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); | 169 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); |
| 170 } | 170 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 185 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { | 185 void KioskProfileLoader::OnProfilePrepared(Profile* profile) { |
| 186 // This object could be deleted any time after successfully reporting | 186 // This object could be deleted any time after successfully reporting |
| 187 // a profile load, so invalidate the LoginUtils delegate now. | 187 // a profile load, so invalidate the LoginUtils delegate now. |
| 188 LoginUtils::Get()->DelegateDeleted(this); | 188 LoginUtils::Get()->DelegateDeleted(this); |
| 189 | 189 |
| 190 delegate_->OnProfileLoaded(profile); | 190 delegate_->OnProfileLoaded(profile); |
| 191 ReportLaunchResult(KioskAppLaunchError::NONE); | 191 ReportLaunchResult(KioskAppLaunchError::NONE); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace chromeos | 194 } // namespace chromeos |
| OLD | NEW |