| 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/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 } | 709 } |
| 710 | 710 |
| 711 string16 AutofillDialogControllerImpl::LegalDocumentsText() { | 711 string16 AutofillDialogControllerImpl::LegalDocumentsText() { |
| 712 if (!IsPayingWithWallet() || autocheckout_state_ != AUTOCHECKOUT_NOT_STARTED) | 712 if (!IsPayingWithWallet() || autocheckout_state_ != AUTOCHECKOUT_NOT_STARTED) |
| 713 return string16(); | 713 return string16(); |
| 714 | 714 |
| 715 EnsureLegalDocumentsText(); | 715 EnsureLegalDocumentsText(); |
| 716 return legal_documents_text_; | 716 return legal_documents_text_; |
| 717 } | 717 } |
| 718 | 718 |
| 719 DialogSignedInState AutofillDialogControllerImpl::SignedInState() const { | 719 bool AutofillDialogControllerImpl::ShouldDisableSignInLink() const { |
| 720 if (account_chooser_model_.HadWalletError()) | 720 return SignedInState() == REQUIRES_RESPONSE; |
| 721 return SIGN_IN_DISABLED; | |
| 722 | |
| 723 if (signin_helper_ || !wallet_items_) | |
| 724 return REQUIRES_RESPONSE; | |
| 725 | |
| 726 if (wallet_items_->HasRequiredAction(wallet::GAIA_AUTH)) | |
| 727 return REQUIRES_SIGN_IN; | |
| 728 | |
| 729 if (wallet_items_->HasRequiredAction(wallet::PASSIVE_GAIA_AUTH)) | |
| 730 return REQUIRES_PASSIVE_SIGN_IN; | |
| 731 | |
| 732 return SIGNED_IN; | |
| 733 } | 721 } |
| 734 | 722 |
| 735 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { | 723 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { |
| 736 return account_chooser_model_.WalletIsSelected() && | 724 return account_chooser_model_.WalletIsSelected() && |
| 737 SignedInState() == REQUIRES_RESPONSE; | 725 SignedInState() == REQUIRES_RESPONSE; |
| 738 } | 726 } |
| 739 | 727 |
| 740 string16 AutofillDialogControllerImpl::AccountChooserText() const { | 728 string16 AutofillDialogControllerImpl::AccountChooserText() const { |
| 741 if (!account_chooser_model_.WalletIsSelected()) | 729 if (!account_chooser_model_.WalletIsSelected()) |
| 742 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAYING_WITHOUT_WALLET); | 730 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAYING_WITHOUT_WALLET); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 GetWalletClient()->GetWalletItems(source_url_); | 885 GetWalletClient()->GetWalletItems(source_url_); |
| 898 } | 886 } |
| 899 | 887 |
| 900 void AutofillDialogControllerImpl::HideSignIn() { | 888 void AutofillDialogControllerImpl::HideSignIn() { |
| 901 ScopedViewUpdates updates(view_.get()); | 889 ScopedViewUpdates updates(view_.get()); |
| 902 signin_registrar_.RemoveAll(); | 890 signin_registrar_.RemoveAll(); |
| 903 view_->HideSignIn(); | 891 view_->HideSignIn(); |
| 904 view_->UpdateAccountChooser(); | 892 view_->UpdateAccountChooser(); |
| 905 } | 893 } |
| 906 | 894 |
| 895 DialogSignedInState AutofillDialogControllerImpl::SignedInState() const { |
| 896 if (account_chooser_model_.HadWalletError()) |
| 897 return SIGN_IN_DISABLED; |
| 898 |
| 899 if (signin_helper_ || !wallet_items_) |
| 900 return REQUIRES_RESPONSE; |
| 901 |
| 902 if (wallet_items_->HasRequiredAction(wallet::GAIA_AUTH)) |
| 903 return REQUIRES_SIGN_IN; |
| 904 |
| 905 if (wallet_items_->HasRequiredAction(wallet::PASSIVE_GAIA_AUTH)) |
| 906 return REQUIRES_PASSIVE_SIGN_IN; |
| 907 |
| 908 return SIGNED_IN; |
| 909 } |
| 910 |
| 907 void AutofillDialogControllerImpl::SignedInStateUpdated() { | 911 void AutofillDialogControllerImpl::SignedInStateUpdated() { |
| 908 switch (SignedInState()) { | 912 switch (SignedInState()) { |
| 909 case SIGNED_IN: | 913 case SIGNED_IN: |
| 910 // Start fetching the user name if we don't know it yet. | 914 // Start fetching the user name if we don't know it yet. |
| 911 if (account_chooser_model_.active_wallet_account_name().empty()) { | 915 if (account_chooser_model_.active_wallet_account_name().empty()) { |
| 912 signin_helper_.reset(new wallet::WalletSigninHelper( | 916 signin_helper_.reset(new wallet::WalletSigninHelper( |
| 913 this, profile_->GetRequestContext())); | 917 this, profile_->GetRequestContext())); |
| 914 signin_helper_->StartUserNameFetch(); | 918 signin_helper_->StartUserNameFetch(); |
| 915 } else { | 919 } else { |
| 916 LogDialogLatencyToShow(); | 920 LogDialogLatencyToShow(); |
| (...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 } | 3510 } |
| 3507 #if !defined(OS_ANDROID) | 3511 #if !defined(OS_ANDROID) |
| 3508 GeneratedCreditCardBubbleController::Show( | 3512 GeneratedCreditCardBubbleController::Show( |
| 3509 web_contents(), | 3513 web_contents(), |
| 3510 full_wallet_->TypeAndLastFourDigits(), | 3514 full_wallet_->TypeAndLastFourDigits(), |
| 3511 backing_last_four); | 3515 backing_last_four); |
| 3512 #endif | 3516 #endif |
| 3513 } | 3517 } |
| 3514 | 3518 |
| 3515 } // namespace autofill | 3519 } // namespace autofill |
| OLD | NEW |