Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 23806002: [rAc] Disable sign-in link while the user's signed-in state is unknown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 686 }
687 687
688 string16 AutofillDialogControllerImpl::LegalDocumentsText() { 688 string16 AutofillDialogControllerImpl::LegalDocumentsText() {
689 if (!IsPayingWithWallet()) 689 if (!IsPayingWithWallet())
690 return string16(); 690 return string16();
691 691
692 EnsureLegalDocumentsText(); 692 EnsureLegalDocumentsText();
693 return legal_documents_text_; 693 return legal_documents_text_;
694 } 694 }
695 695
696 DialogSignedInState AutofillDialogControllerImpl::SignedInState() const { 696 bool AutofillDialogControllerImpl::ShouldDisableSignInLink() const {
697 if (wallet_error_notification_) 697 return SignedInState() == REQUIRES_RESPONSE;
698 return SIGN_IN_DISABLED;
699
700 if (signin_helper_ || !wallet_items_)
701 return REQUIRES_RESPONSE;
702
703 if (wallet_items_->HasRequiredAction(wallet::GAIA_AUTH))
704 return REQUIRES_SIGN_IN;
705
706 if (wallet_items_->HasRequiredAction(wallet::PASSIVE_GAIA_AUTH))
707 return REQUIRES_PASSIVE_SIGN_IN;
708
709 return SIGNED_IN;
710 } 698 }
711 699
712 bool AutofillDialogControllerImpl::ShouldShowSpinner() const { 700 bool AutofillDialogControllerImpl::ShouldShowSpinner() const {
713 return account_chooser_model_.WalletIsSelected() && 701 return account_chooser_model_.WalletIsSelected() &&
714 SignedInState() == REQUIRES_RESPONSE; 702 SignedInState() == REQUIRES_RESPONSE;
715 } 703 }
716 704
717 string16 AutofillDialogControllerImpl::AccountChooserText() const { 705 string16 AutofillDialogControllerImpl::AccountChooserText() const {
718 if (!account_chooser_model_.WalletIsSelected()) 706 if (!account_chooser_model_.WalletIsSelected())
719 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAYING_WITHOUT_WALLET); 707 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PAYING_WITHOUT_WALLET);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 GetWalletClient()->GetWalletItems(source_url_); 852 GetWalletClient()->GetWalletItems(source_url_);
865 } 853 }
866 854
867 void AutofillDialogControllerImpl::HideSignIn() { 855 void AutofillDialogControllerImpl::HideSignIn() {
868 ScopedViewUpdates updates(view_.get()); 856 ScopedViewUpdates updates(view_.get());
869 signin_registrar_.RemoveAll(); 857 signin_registrar_.RemoveAll();
870 view_->HideSignIn(); 858 view_->HideSignIn();
871 view_->UpdateAccountChooser(); 859 view_->UpdateAccountChooser();
872 } 860 }
873 861
862 AutofillDialogControllerImpl::DialogSignedInState
863 AutofillDialogControllerImpl::SignedInState() const {
864 if (wallet_error_notification_)
865 return SIGN_IN_DISABLED;
866
867 if (signin_helper_ || !wallet_items_)
868 return REQUIRES_RESPONSE;
869
870 if (wallet_items_->HasRequiredAction(wallet::GAIA_AUTH))
871 return REQUIRES_SIGN_IN;
872
873 if (wallet_items_->HasRequiredAction(wallet::PASSIVE_GAIA_AUTH))
874 return REQUIRES_PASSIVE_SIGN_IN;
875
876 return SIGNED_IN;
877 }
878
874 void AutofillDialogControllerImpl::SignedInStateUpdated() { 879 void AutofillDialogControllerImpl::SignedInStateUpdated() {
875 switch (SignedInState()) { 880 switch (SignedInState()) {
876 case SIGNED_IN: 881 case SIGNED_IN:
877 // Start fetching the user name if we don't know it yet. 882 // Start fetching the user name if we don't know it yet.
878 if (account_chooser_model_.active_wallet_account_name().empty()) { 883 if (account_chooser_model_.active_wallet_account_name().empty()) {
879 signin_helper_.reset(new wallet::WalletSigninHelper( 884 signin_helper_.reset(new wallet::WalletSigninHelper(
880 this, profile_->GetRequestContext())); 885 this, profile_->GetRequestContext()));
881 signin_helper_->StartUserNameFetch(); 886 signin_helper_->StartUserNameFetch();
882 } else { 887 } else {
883 LogDialogLatencyToShow(); 888 LogDialogLatencyToShow();
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 } 3334 }
3330 #if !defined(OS_ANDROID) 3335 #if !defined(OS_ANDROID)
3331 GeneratedCreditCardBubbleController::Show( 3336 GeneratedCreditCardBubbleController::Show(
3332 web_contents(), 3337 web_contents(),
3333 full_wallet_->TypeAndLastFourDigits(), 3338 full_wallet_->TypeAndLastFourDigits(),
3334 backing_last_four); 3339 backing_last_four);
3335 #endif 3340 #endif
3336 } 3341 }
3337 3342
3338 } // namespace autofill 3343 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/autofill_dialog_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698