| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auth/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 true, // online_complete | 293 true, // online_complete |
| 294 false)); // user_is_new | 294 false)); // user_is_new |
| 295 remove_user_data_on_failure_ = false; | 295 remove_user_data_on_failure_ = false; |
| 296 check_key_attempted_ = true; | 296 check_key_attempted_ = true; |
| 297 SystemSaltGetter::Get()->GetSystemSalt( | 297 SystemSaltGetter::Get()->GetSystemSalt( |
| 298 base::Bind(&CheckKey, | 298 base::Bind(&CheckKey, |
| 299 current_state_.get(), | 299 current_state_.get(), |
| 300 scoped_refptr<ParallelAuthenticator>(this))); | 300 scoped_refptr<ParallelAuthenticator>(this))); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void ParallelAuthenticator::LoginAsLocallyManagedUser( | 303 void ParallelAuthenticator::LoginAsSupervisedUser( |
| 304 const UserContext& user_context) { | 304 const UserContext& user_context) { |
| 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 306 // TODO(nkostylev): Pass proper value for |user_is_new| or remove (not used). | 306 // TODO(nkostylev): Pass proper value for |user_is_new| or remove (not used). |
| 307 current_state_.reset( | 307 current_state_.reset( |
| 308 new AuthAttemptState(user_context, | 308 new AuthAttemptState(user_context, |
| 309 user_manager::USER_TYPE_LOCALLY_MANAGED, | 309 user_manager::USER_TYPE_SUPERVISED, |
| 310 false, // unlock | 310 false, // unlock |
| 311 false, // online_complete | 311 false, // online_complete |
| 312 false)); // user_is_new | 312 false)); // user_is_new |
| 313 remove_user_data_on_failure_ = false; | 313 remove_user_data_on_failure_ = false; |
| 314 SystemSaltGetter::Get()->GetSystemSalt( | 314 SystemSaltGetter::Get()->GetSystemSalt( |
| 315 base::Bind(&Mount, | 315 base::Bind(&Mount, |
| 316 current_state_.get(), | 316 current_state_.get(), |
| 317 scoped_refptr<ParallelAuthenticator>(this), | 317 scoped_refptr<ParallelAuthenticator>(this), |
| 318 cryptohome::MOUNT_FLAGS_NONE)); | 318 cryptohome::MOUNT_FLAGS_NONE)); |
| 319 } | 319 } |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 base::Bind(&ParallelAuthenticator::OnOffTheRecordAuthSuccess, this)); | 648 base::Bind(&ParallelAuthenticator::OnOffTheRecordAuthSuccess, this)); |
| 649 break; | 649 break; |
| 650 case KIOSK_ACCOUNT_LOGIN: | 650 case KIOSK_ACCOUNT_LOGIN: |
| 651 case PUBLIC_ACCOUNT_LOGIN: | 651 case PUBLIC_ACCOUNT_LOGIN: |
| 652 current_state_->user_context.SetIsUsingOAuth(false); | 652 current_state_->user_context.SetIsUsingOAuth(false); |
| 653 BrowserThread::PostTask( | 653 BrowserThread::PostTask( |
| 654 BrowserThread::UI, | 654 BrowserThread::UI, |
| 655 FROM_HERE, | 655 FROM_HERE, |
| 656 base::Bind(&ParallelAuthenticator::OnAuthSuccess, this)); | 656 base::Bind(&ParallelAuthenticator::OnAuthSuccess, this)); |
| 657 break; | 657 break; |
| 658 case LOCALLY_MANAGED_USER_LOGIN: | 658 case SUPERVISED_USER_LOGIN: |
| 659 current_state_->user_context.SetIsUsingOAuth(false); | 659 current_state_->user_context.SetIsUsingOAuth(false); |
| 660 BrowserThread::PostTask( | 660 BrowserThread::PostTask( |
| 661 BrowserThread::UI, | 661 BrowserThread::UI, |
| 662 FROM_HERE, | 662 FROM_HERE, |
| 663 base::Bind(&ParallelAuthenticator::OnAuthSuccess, this)); | 663 base::Bind(&ParallelAuthenticator::OnAuthSuccess, this)); |
| 664 break; | 664 break; |
| 665 case LOGIN_FAILED: | 665 case LOGIN_FAILED: |
| 666 current_state_->ResetCryptohomeStatus(); | 666 current_state_->ResetCryptohomeStatus(); |
| 667 BrowserThread::PostTask(BrowserThread::UI, | 667 BrowserThread::PostTask(BrowserThread::UI, |
| 668 FROM_HERE, | 668 FROM_HERE, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 return UNLOCK; | 793 return UNLOCK; |
| 794 | 794 |
| 795 if (current_state_->user_type == user_manager::USER_TYPE_GUEST) | 795 if (current_state_->user_type == user_manager::USER_TYPE_GUEST) |
| 796 return GUEST_LOGIN; | 796 return GUEST_LOGIN; |
| 797 if (current_state_->user_type == user_manager::USER_TYPE_RETAIL_MODE) | 797 if (current_state_->user_type == user_manager::USER_TYPE_RETAIL_MODE) |
| 798 return DEMO_LOGIN; | 798 return DEMO_LOGIN; |
| 799 if (current_state_->user_type == user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 799 if (current_state_->user_type == user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 800 return PUBLIC_ACCOUNT_LOGIN; | 800 return PUBLIC_ACCOUNT_LOGIN; |
| 801 if (current_state_->user_type == user_manager::USER_TYPE_KIOSK_APP) | 801 if (current_state_->user_type == user_manager::USER_TYPE_KIOSK_APP) |
| 802 return KIOSK_ACCOUNT_LOGIN; | 802 return KIOSK_ACCOUNT_LOGIN; |
| 803 if (current_state_->user_type == user_manager::USER_TYPE_LOCALLY_MANAGED) | 803 if (current_state_->user_type == user_manager::USER_TYPE_SUPERVISED) |
| 804 return LOCALLY_MANAGED_USER_LOGIN; | 804 return SUPERVISED_USER_LOGIN; |
| 805 | 805 |
| 806 if (!VerifyOwner()) | 806 if (!VerifyOwner()) |
| 807 return CONTINUE; | 807 return CONTINUE; |
| 808 return user_can_login_ ? OFFLINE_LOGIN : OWNER_REQUIRED; | 808 return user_can_login_ ? OFFLINE_LOGIN : OWNER_REQUIRED; |
| 809 } | 809 } |
| 810 | 810 |
| 811 ParallelAuthenticator::AuthState | 811 ParallelAuthenticator::AuthState |
| 812 ParallelAuthenticator::ResolveOnlineSuccessState( | 812 ParallelAuthenticator::ResolveOnlineSuccessState( |
| 813 ParallelAuthenticator::AuthState offline_state) { | 813 ParallelAuthenticator::AuthState offline_state) { |
| 814 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 814 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 831 Resolve(); | 831 Resolve(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 834 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
| 835 bool check_result) { | 835 bool check_result) { |
| 836 owner_is_verified_ = owner_check_finished; | 836 owner_is_verified_ = owner_check_finished; |
| 837 user_can_login_ = check_result; | 837 user_can_login_ = check_result; |
| 838 } | 838 } |
| 839 | 839 |
| 840 } // namespace chromeos | 840 } // namespace chromeos |
| OLD | NEW |