OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 SystemSaltGetter::Get()->GetSystemSalt( | 341 SystemSaltGetter::Get()->GetSystemSalt( |
342 base::Bind(&Mount, | 342 base::Bind(&Mount, |
343 current_state_.get(), | 343 current_state_.get(), |
344 scoped_refptr<ParallelAuthenticator>(this), | 344 scoped_refptr<ParallelAuthenticator>(this), |
345 cryptohome::CREATE_IF_MISSING | cryptohome::ENSURE_EPHEMERAL)); | 345 cryptohome::CREATE_IF_MISSING | cryptohome::ENSURE_EPHEMERAL)); |
346 } | 346 } |
347 | 347 |
348 void ParallelAuthenticator::LoginAsKioskAccount( | 348 void ParallelAuthenticator::LoginAsKioskAccount( |
349 const std::string& app_user_id, bool force_ephemeral) { | 349 const std::string& app_user_id, bool force_ephemeral) { |
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 351 |
| 352 std::string user_id = |
| 353 force_ephemeral ? UserManager::kGuestUserName : app_user_id; |
351 current_state_.reset(new AuthAttemptState( | 354 current_state_.reset(new AuthAttemptState( |
352 UserContext(app_user_id, | 355 UserContext(user_id, |
353 std::string(), // password | 356 std::string(), // password |
354 std::string()), // auth_code | 357 std::string()), // auth_code |
355 std::string(), // login_token | 358 std::string(), // login_token |
356 std::string(), // login_captcha | 359 std::string(), // login_captcha |
357 User::USER_TYPE_KIOSK_APP, | 360 User::USER_TYPE_KIOSK_APP, |
358 false)); | 361 false)); |
| 362 |
359 remove_user_data_on_failure_ = true; | 363 remove_user_data_on_failure_ = true; |
360 int ephemeral_flag = force_ephemeral ? cryptohome::ENSURE_EPHEMERAL : 0; | 364 if (!force_ephemeral) { |
361 MountPublic(current_state_.get(), | 365 MountPublic(current_state_.get(), |
362 scoped_refptr<ParallelAuthenticator>(this), | 366 scoped_refptr<ParallelAuthenticator>(this), |
363 cryptohome::CREATE_IF_MISSING | ephemeral_flag); | 367 cryptohome::CREATE_IF_MISSING); |
| 368 } else { |
| 369 ephemeral_mount_attempted_ = true; |
| 370 MountGuest(current_state_.get(), |
| 371 scoped_refptr<ParallelAuthenticator>(this)); |
| 372 } |
364 } | 373 } |
365 | 374 |
366 void ParallelAuthenticator::OnRetailModeLoginSuccess() { | 375 void ParallelAuthenticator::OnRetailModeLoginSuccess() { |
367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
368 VLOG(1) << "Retail mode login success"; | 377 VLOG(1) << "Retail mode login success"; |
369 // Send notification of success | 378 // Send notification of success |
370 AuthenticationNotificationDetails details(true); | 379 AuthenticationNotificationDetails details(true); |
371 content::NotificationService::current()->Notify( | 380 content::NotificationService::current()->Notify( |
372 chrome::NOTIFICATION_LOGIN_AUTHENTICATION, | 381 chrome::NOTIFICATION_LOGIN_AUTHENTICATION, |
373 content::NotificationService::AllSources(), | 382 content::NotificationService::AllSources(), |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 Resolve(); | 816 Resolve(); |
808 } | 817 } |
809 | 818 |
810 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 819 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
811 bool check_result) { | 820 bool check_result) { |
812 owner_is_verified_ = owner_check_finished; | 821 owner_is_verified_ = owner_check_finished; |
813 user_can_login_ = check_result; | 822 user_can_login_ = check_result; |
814 } | 823 } |
815 | 824 |
816 } // namespace chromeos | 825 } // namespace chromeos |
OLD | NEW |