OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 ParallelAuthenticator::ResolveCryptohomeFailureState() { | 542 ParallelAuthenticator::ResolveCryptohomeFailureState() { |
543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
544 if (data_remover_.get()) | 544 if (data_remover_.get()) |
545 return FAILED_REMOVE; | 545 return FAILED_REMOVE; |
546 if (guest_mounter_.get()) | 546 if (guest_mounter_.get()) |
547 return FAILED_TMPFS; | 547 return FAILED_TMPFS; |
548 if (key_migrator_.get()) | 548 if (key_migrator_.get()) |
549 return NEED_OLD_PW; | 549 return NEED_OLD_PW; |
550 if (key_checker_.get()) | 550 if (key_checker_.get()) |
551 return LOGIN_FAILED; | 551 return LOGIN_FAILED; |
552 if (current_state_->cryptohome_code() == | 552 |
553 chromeos::kCryptohomeMountErrorKeyFailure) { | 553 // Return intermediate states in the following cases: |
554 // If we tried a mount but they used the wrong key, we may need to | 554 // 1. When there is a parallel online attempt to resolve them later; |
555 // ask the user for her old password. We'll only know once we've | 555 // This is the case with legacy ClientLogin flow; |
556 // done the online check. | 556 // 2. When there is an online result to use; |
557 return POSSIBLE_PW_CHANGE; | 557 // This is the case after user finishes Gaia login; |
| 558 if (current_online_.get() || current_state_->online_complete()) { |
| 559 if (current_state_->cryptohome_code() == |
| 560 chromeos::kCryptohomeMountErrorKeyFailure) { |
| 561 // If we tried a mount but they used the wrong key, we may need to |
| 562 // ask the user for her old password. We'll only know once we've |
| 563 // done the online check. |
| 564 return POSSIBLE_PW_CHANGE; |
| 565 } |
| 566 if (current_state_->cryptohome_code() == |
| 567 chromeos::kCryptohomeMountErrorUserDoesNotExist) { |
| 568 // If we tried a mount but the user did not exist, then we should wait |
| 569 // for online login to succeed and try again with the "create" flag set. |
| 570 return NO_MOUNT; |
| 571 } |
558 } | 572 } |
559 if (current_state_->cryptohome_code() == | 573 |
560 chromeos::kCryptohomeMountErrorUserDoesNotExist) { | |
561 // If we tried a mount but the user did not exist, then we should wait | |
562 // for online login to succeed and try again with the "create" flag set. | |
563 return NO_MOUNT; | |
564 } | |
565 return FAILED_MOUNT; | 574 return FAILED_MOUNT; |
566 } | 575 } |
567 | 576 |
568 ParallelAuthenticator::AuthState | 577 ParallelAuthenticator::AuthState |
569 ParallelAuthenticator::ResolveCryptohomeSuccessState() { | 578 ParallelAuthenticator::ResolveCryptohomeSuccessState() { |
570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 579 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
571 if (data_remover_.get()) | 580 if (data_remover_.get()) |
572 return CREATE_NEW; | 581 return CREATE_NEW; |
573 if (guest_mounter_.get()) | 582 if (guest_mounter_.get()) |
574 return LOCAL_LOGIN; | 583 return LOCAL_LOGIN; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 } | 721 } |
713 | 722 |
714 void ParallelAuthenticator::ResolveLoginCompletionStatus() { | 723 void ParallelAuthenticator::ResolveLoginCompletionStatus() { |
715 // Shortcut online state resolution process. | 724 // Shortcut online state resolution process. |
716 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(), | 725 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(), |
717 LoginFailure::None()); | 726 LoginFailure::None()); |
718 Resolve(); | 727 Resolve(); |
719 } | 728 } |
720 | 729 |
721 } // namespace chromeos | 730 } // namespace chromeos |
OLD | NEW |