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/chrome_login_performer.h" | 13 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
14 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 14 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
15 #include "chrome/browser/chromeos/login/login_utils.h" | |
16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
18 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
19 #include "chromeos/cryptohome/async_method_caller.h" | 18 #include "chromeos/cryptohome/async_method_caller.h" |
20 #include "chromeos/dbus/cryptohome_client.h" | 19 #include "chromeos/dbus/cryptohome_client.h" |
21 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
22 #include "chromeos/login/auth/auth_status_consumer.h" | 21 #include "chromeos/login/auth/auth_status_consumer.h" |
23 #include "chromeos/login/auth/user_context.h" | 22 #include "chromeos/login/auth/user_context.h" |
24 #include "chromeos/login/user_names.h" | 23 #include "chromeos/login/user_names.h" |
25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ignore_result(login_performer_.release()); | 152 ignore_result(login_performer_.release()); |
154 | 153 |
155 // 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 |
156 // 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 |
157 // 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 |
158 // 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 |
159 // user as a demo user. | 158 // user as a demo user. |
160 UserContext context = user_context; | 159 UserContext context = user_context; |
161 if (context.GetUserID() == chromeos::login::kGuestUserName) | 160 if (context.GetUserID() == chromeos::login::kGuestUserName) |
162 context.SetUserID(DemoAppLauncher::kDemoUserName); | 161 context.SetUserID(DemoAppLauncher::kDemoUserName); |
163 LoginUtils::Get()->PrepareProfile(context, | 162 UserSessionManager::GetInstance()->StartSession( |
164 false, // has_auth_cookies | 163 context, UserSessionManager::PRIMARY_USER_SESSION, |
165 false, // has_active_session | 164 false, // has_auth_cookies |
166 this); | 165 false, // Start session for user. |
| 166 this); |
167 } | 167 } |
168 | 168 |
169 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { | 169 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { |
170 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); | 170 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); |
171 } | 171 } |
172 | 172 |
173 void KioskProfileLoader::WhiteListCheckFailed(const std::string& email) { | 173 void KioskProfileLoader::WhiteListCheckFailed(const std::string& email) { |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 } | 175 } |
176 | 176 |
177 void KioskProfileLoader::PolicyLoadFailed() { | 177 void KioskProfileLoader::PolicyLoadFailed() { |
178 ReportLaunchResult(KioskAppLaunchError::POLICY_LOAD_FAILED); | 178 ReportLaunchResult(KioskAppLaunchError::POLICY_LOAD_FAILED); |
179 } | 179 } |
180 | 180 |
181 void KioskProfileLoader::OnOnlineChecked( | 181 void KioskProfileLoader::OnOnlineChecked( |
182 const std::string& email, bool success) { | 182 const std::string& email, bool success) { |
183 NOTREACHED(); | 183 NOTREACHED(); |
184 } | 184 } |
185 | 185 |
186 void KioskProfileLoader::OnProfilePrepared(Profile* profile, | 186 void KioskProfileLoader::OnProfilePrepared(Profile* profile, |
187 bool browser_launched) { | 187 bool browser_launched) { |
188 // This object could be deleted any time after successfully reporting | 188 // This object could be deleted any time after successfully reporting |
189 // a profile load, so invalidate the LoginUtils delegate now. | 189 // a profile load, so invalidate the delegate now. |
190 LoginUtils::Get()->DelegateDeleted(this); | 190 UserSessionManager::GetInstance()->DelegateDeleted(this); |
191 | 191 |
192 delegate_->OnProfileLoaded(profile); | 192 delegate_->OnProfileLoaded(profile); |
193 ReportLaunchResult(KioskAppLaunchError::NONE); | 193 ReportLaunchResult(KioskAppLaunchError::NONE); |
194 } | 194 } |
195 | 195 |
196 } // namespace chromeos | 196 } // namespace chromeos |
OLD | NEW |