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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 return section == SECTION_CC_BILLING || section == SECTION_SHIPPING; | 869 return section == SECTION_CC_BILLING || section == SECTION_SHIPPING; |
870 | 870 |
871 return section != SECTION_CC_BILLING; | 871 return section != SECTION_CC_BILLING; |
872 } | 872 } |
873 | 873 |
874 void AutofillDialogControllerImpl::GetWalletItems() { | 874 void AutofillDialogControllerImpl::GetWalletItems() { |
875 ScopedViewUpdates updates(view_.get()); | 875 ScopedViewUpdates updates(view_.get()); |
876 | 876 |
877 wallet_items_requested_ = true; | 877 wallet_items_requested_ = true; |
878 wallet::WalletClient* wallet_client = GetWalletClient(); | 878 wallet::WalletClient* wallet_client = GetWalletClient(); |
879 wallet_client->CancelRequests(); | 879 wallet_client->CancelRequest(); |
880 | 880 |
881 previously_selected_instrument_id_.clear(); | 881 previously_selected_instrument_id_.clear(); |
882 previously_selected_shipping_address_id_.clear(); | 882 previously_selected_shipping_address_id_.clear(); |
883 if (wallet_items_) { | 883 if (wallet_items_) { |
884 previous_default_instrument_id_ = wallet_items_->default_instrument_id(); | 884 previous_default_instrument_id_ = wallet_items_->default_instrument_id(); |
885 previous_default_shipping_address_id_ = wallet_items_->default_address_id(); | 885 previous_default_shipping_address_id_ = wallet_items_->default_address_id(); |
886 | 886 |
887 const wallet::WalletItems::MaskedInstrument* instrument = | 887 const wallet::WalletItems::MaskedInstrument* instrument = |
888 ActiveInstrument(); | 888 ActiveInstrument(); |
889 if (instrument) | 889 if (instrument) |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 | 2415 |
2416 void AutofillDialogControllerImpl::AccountChooserWillShow() { | 2416 void AutofillDialogControllerImpl::AccountChooserWillShow() { |
2417 HidePopup(); | 2417 HidePopup(); |
2418 } | 2418 } |
2419 | 2419 |
2420 void AutofillDialogControllerImpl::AccountChoiceChanged() { | 2420 void AutofillDialogControllerImpl::AccountChoiceChanged() { |
2421 ScopedViewUpdates updates(view_.get()); | 2421 ScopedViewUpdates updates(view_.get()); |
2422 wallet::WalletClient* client = GetWalletClient(); | 2422 wallet::WalletClient* client = GetWalletClient(); |
2423 | 2423 |
2424 if (is_submitting_) | 2424 if (is_submitting_) |
2425 client->CancelRequests(); | 2425 client->CancelRequest(); |
2426 | 2426 |
2427 SetIsSubmitting(false); | 2427 SetIsSubmitting(false); |
2428 | 2428 |
2429 size_t selected_user_index = | 2429 size_t selected_user_index = |
2430 account_chooser_model_->GetActiveWalletAccountIndex(); | 2430 account_chooser_model_->GetActiveWalletAccountIndex(); |
2431 if (account_chooser_model_->WalletIsSelected() && | 2431 if (account_chooser_model_->WalletIsSelected() && |
2432 client->user_index() != selected_user_index) { | 2432 client->user_index() != selected_user_index) { |
2433 client->SetUserIndex(selected_user_index); | 2433 client->SetUserIndex(selected_user_index); |
2434 // Clear |wallet_items_| so we don't try to restore the selected instrument | 2434 // Clear |wallet_items_| so we don't try to restore the selected instrument |
2435 // and address. | 2435 // and address. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 | 2619 |
2620 bool AutofillDialogControllerImpl::IsManuallyEditingSection( | 2620 bool AutofillDialogControllerImpl::IsManuallyEditingSection( |
2621 DialogSection section) const { | 2621 DialogSection section) const { |
2622 return IsEditingExistingData(section) || | 2622 return IsEditingExistingData(section) || |
2623 SuggestionsMenuModelForSection(section)-> | 2623 SuggestionsMenuModelForSection(section)-> |
2624 GetItemKeyForCheckedItem() == kAddNewItemKey; | 2624 GetItemKeyForCheckedItem() == kAddNewItemKey; |
2625 } | 2625 } |
2626 | 2626 |
2627 void AutofillDialogControllerImpl::OnWalletSigninError() { | 2627 void AutofillDialogControllerImpl::OnWalletSigninError() { |
2628 account_chooser_model_->SetHadWalletSigninError(); | 2628 account_chooser_model_->SetHadWalletSigninError(); |
2629 GetWalletClient()->CancelRequests(); | 2629 GetWalletClient()->CancelRequest(); |
2630 LogDialogLatencyToShow(); | 2630 LogDialogLatencyToShow(); |
2631 } | 2631 } |
2632 | 2632 |
2633 void AutofillDialogControllerImpl::DisableWallet( | 2633 void AutofillDialogControllerImpl::DisableWallet( |
2634 wallet::WalletClient::ErrorType error_type) { | 2634 wallet::WalletClient::ErrorType error_type) { |
2635 signin_helper_.reset(); | 2635 signin_helper_.reset(); |
2636 wallet_items_.reset(); | 2636 wallet_items_.reset(); |
2637 wallet_errors_.clear(); | 2637 wallet_errors_.clear(); |
2638 GetWalletClient()->CancelRequests(); | 2638 GetWalletClient()->CancelRequest(); |
2639 SetIsSubmitting(false); | 2639 SetIsSubmitting(false); |
2640 wallet_error_notification_ = GetWalletError(error_type); | 2640 wallet_error_notification_ = GetWalletError(error_type); |
2641 account_chooser_model_->SetHadWalletError(); | 2641 account_chooser_model_->SetHadWalletError(); |
2642 } | 2642 } |
2643 | 2643 |
2644 void AutofillDialogControllerImpl::SuggestionsUpdated() { | 2644 void AutofillDialogControllerImpl::SuggestionsUpdated() { |
2645 ScopedViewUpdates updates(view_.get()); | 2645 ScopedViewUpdates updates(view_.get()); |
2646 | 2646 |
2647 const FieldValueMap snapshot = TakeUserInputSnapshot(); | 2647 const FieldValueMap snapshot = TakeUserInputSnapshot(); |
2648 | 2648 |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 view_->UpdateButtonStrip(); | 3538 view_->UpdateButtonStrip(); |
3539 } | 3539 } |
3540 | 3540 |
3541 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3541 void AutofillDialogControllerImpl::FetchWalletCookie() { |
3542 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3542 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
3543 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3543 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
3544 signin_helper_->StartWalletCookieValueFetch(); | 3544 signin_helper_->StartWalletCookieValueFetch(); |
3545 } | 3545 } |
3546 | 3546 |
3547 } // namespace autofill | 3547 } // namespace autofill |
OLD | NEW |