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/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
16 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" | 16 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
17 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 17 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chromeos/cryptohome/async_method_caller.h" | 21 #include "chromeos/cryptohome/async_method_caller.h" |
22 #include "chromeos/dbus/cryptohome_client.h" | 22 #include "chromeos/dbus/cryptohome_client.h" |
23 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
24 #include "chromeos/login/auth/auth_status_consumer.h" | 24 #include "chromeos/login/auth/auth_status_consumer.h" |
25 #include "chromeos/login/auth/user_context.h" | 25 #include "chromeos/login/auth/user_context.h" |
26 #include "chromeos/login/user_names.h" | |
27 #include "components/signin/core/account_id/account_id.h" | 26 #include "components/signin/core/account_id/account_id.h" |
| 27 #include "components/user_manager/user_names.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "google_apis/gaia/gaia_auth_util.h" | 29 #include "google_apis/gaia/gaia_auth_util.h" |
30 | 30 |
31 using content::BrowserThread; | 31 using content::BrowserThread; |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 KioskAppLaunchError::Error LoginFailureToKioskAppLaunchError( | 37 KioskAppLaunchError::Error LoginFailureToKioskAppLaunchError( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // LoginPerformer will delete itself. | 168 // LoginPerformer will delete itself. |
169 login_performer_->set_delegate(NULL); | 169 login_performer_->set_delegate(NULL); |
170 ignore_result(login_performer_.release()); | 170 ignore_result(login_performer_.release()); |
171 | 171 |
172 // If we are launching a demo session, we need to start MountGuest with the | 172 // If we are launching a demo session, we need to start MountGuest with the |
173 // guest username; this is because there are several places in the cros code | 173 // guest username; this is because there are several places in the cros code |
174 // which rely on the username sent to cryptohome to be $guest. Back in Chrome | 174 // which rely on the username sent to cryptohome to be $guest. Back in Chrome |
175 // we switch this back to the demo user name to correctly identify this | 175 // we switch this back to the demo user name to correctly identify this |
176 // user as a demo user. | 176 // user as a demo user. |
177 UserContext context = user_context; | 177 UserContext context = user_context; |
178 if (context.GetAccountId() == login::GuestAccountId()) | 178 if (context.GetAccountId() == user_manager::GuestAccountId()) |
179 context.SetAccountId(login::DemoAccountId()); | 179 context.SetAccountId(user_manager::DemoAccountId()); |
180 UserSessionManager::GetInstance()->StartSession( | 180 UserSessionManager::GetInstance()->StartSession( |
181 context, UserSessionManager::PRIMARY_USER_SESSION, | 181 context, UserSessionManager::PRIMARY_USER_SESSION, |
182 false, // has_auth_cookies | 182 false, // has_auth_cookies |
183 false, // Start session for user. | 183 false, // Start session for user. |
184 this); | 184 this); |
185 } | 185 } |
186 | 186 |
187 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { | 187 void KioskProfileLoader::OnAuthFailure(const AuthFailure& error) { |
188 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); | 188 ReportLaunchResult(LoginFailureToKioskAppLaunchError(error)); |
189 } | 189 } |
(...skipping 14 matching lines...) Expand all Loading... |
204 bool browser_launched) { | 204 bool browser_launched) { |
205 // This object could be deleted any time after successfully reporting | 205 // This object could be deleted any time after successfully reporting |
206 // a profile load, so invalidate the delegate now. | 206 // a profile load, so invalidate the delegate now. |
207 UserSessionManager::GetInstance()->DelegateDeleted(this); | 207 UserSessionManager::GetInstance()->DelegateDeleted(this); |
208 | 208 |
209 delegate_->OnProfileLoaded(profile); | 209 delegate_->OnProfileLoaded(profile); |
210 ReportLaunchResult(KioskAppLaunchError::NONE); | 210 ReportLaunchResult(KioskAppLaunchError::NONE); |
211 } | 211 } |
212 | 212 |
213 } // namespace chromeos | 213 } // namespace chromeos |
OLD | NEW |