| 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 CvcIconForCreditCardType(credit_card_type); | 1605 CvcIconForCreditCardType(credit_card_type); |
| 1606 | 1606 |
| 1607 return result; | 1607 return result; |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 bool AutofillDialogControllerImpl::FieldControlsIcons( | 1610 bool AutofillDialogControllerImpl::FieldControlsIcons( |
| 1611 ServerFieldType type) const { | 1611 ServerFieldType type) const { |
| 1612 return type == CREDIT_CARD_NUMBER; | 1612 return type == CREDIT_CARD_NUMBER; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 // TODO(estade): Replace all the error messages here with more helpful and | 1615 // TODO(groby): Add more tests. |
| 1616 // translateable ones. TODO(groby): Also add tests. | |
| 1617 string16 AutofillDialogControllerImpl::InputValidityMessage( | 1616 string16 AutofillDialogControllerImpl::InputValidityMessage( |
| 1618 DialogSection section, | 1617 DialogSection section, |
| 1619 ServerFieldType type, | 1618 ServerFieldType type, |
| 1620 const string16& value) { | 1619 const string16& value) { |
| 1621 // If the field is edited, clear any Wallet errors. | 1620 // If the field is edited, clear any Wallet errors. |
| 1622 if (IsPayingWithWallet()) { | 1621 if (IsPayingWithWallet()) { |
| 1623 WalletValidationErrors::iterator it = wallet_errors_.find(section); | 1622 WalletValidationErrors::iterator it = wallet_errors_.find(section); |
| 1624 if (it != wallet_errors_.end()) { | 1623 if (it != wallet_errors_.end()) { |
| 1625 TypeErrorInputMap::const_iterator iter = it->second.find(type); | 1624 TypeErrorInputMap::const_iterator iter = it->second.find(type); |
| 1626 if (iter != it->second.end()) { | 1625 if (iter != it->second.end()) { |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 | 2196 |
| 2198 void AutofillDialogControllerImpl::OnDidAcceptLegalDocuments() { | 2197 void AutofillDialogControllerImpl::OnDidAcceptLegalDocuments() { |
| 2199 DCHECK(is_submitting_ && IsPayingWithWallet()); | 2198 DCHECK(is_submitting_ && IsPayingWithWallet()); |
| 2200 has_accepted_legal_documents_ = true; | 2199 has_accepted_legal_documents_ = true; |
| 2201 LoadRiskFingerprintData(); | 2200 LoadRiskFingerprintData(); |
| 2202 } | 2201 } |
| 2203 | 2202 |
| 2204 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) { | 2203 void AutofillDialogControllerImpl::OnDidAuthenticateInstrument(bool success) { |
| 2205 DCHECK(is_submitting_ && IsPayingWithWallet()); | 2204 DCHECK(is_submitting_ && IsPayingWithWallet()); |
| 2206 | 2205 |
| 2207 // TODO(dbeam): use the returned full wallet. b/8332329 | 2206 // TODO(dbeam): use the returned full wallet. http://crbug.com/224992 |
| 2208 if (success) { | 2207 if (success) { |
| 2209 GetFullWallet(); | 2208 GetFullWallet(); |
| 2210 } else { | 2209 } else { |
| 2211 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); | 2210 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); |
| 2212 SuggestionsUpdated(); | 2211 SuggestionsUpdated(); |
| 2213 } | 2212 } |
| 2214 } | 2213 } |
| 2215 | 2214 |
| 2216 void AutofillDialogControllerImpl::OnDidGetFullWallet( | 2215 void AutofillDialogControllerImpl::OnDidGetFullWallet( |
| 2217 scoped_ptr<wallet::FullWallet> full_wallet) { | 2216 scoped_ptr<wallet::FullWallet> full_wallet) { |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 source_url_, | 3151 source_url_, |
| 3153 wallet_items_->google_transaction_id(), | 3152 wallet_items_->google_transaction_id(), |
| 3154 capabilities, | 3153 capabilities, |
| 3155 wallet_items_->HasRequiredAction(wallet::SETUP_WALLET))); | 3154 wallet_items_->HasRequiredAction(wallet::SETUP_WALLET))); |
| 3156 } | 3155 } |
| 3157 | 3156 |
| 3158 void AutofillDialogControllerImpl::HandleSaveOrUpdateRequiredActions( | 3157 void AutofillDialogControllerImpl::HandleSaveOrUpdateRequiredActions( |
| 3159 const std::vector<wallet::RequiredAction>& required_actions) { | 3158 const std::vector<wallet::RequiredAction>& required_actions) { |
| 3160 DCHECK(!required_actions.empty()); | 3159 DCHECK(!required_actions.empty()); |
| 3161 | 3160 |
| 3162 // TODO(ahutter): Invesitigate if we need to support more generic actions on | 3161 // TODO(ahutter): Investigate if we need to support more generic actions on |
| 3163 // this call such as GAIA_AUTH. See crbug.com/243457. | 3162 // this call such as GAIA_AUTH. See crbug.com/243457. |
| 3164 for (std::vector<wallet::RequiredAction>::const_iterator iter = | 3163 for (std::vector<wallet::RequiredAction>::const_iterator iter = |
| 3165 required_actions.begin(); | 3164 required_actions.begin(); |
| 3166 iter != required_actions.end(); ++iter) { | 3165 iter != required_actions.end(); ++iter) { |
| 3167 if (*iter != wallet::INVALID_FORM_FIELD) { | 3166 if (*iter != wallet::INVALID_FORM_FIELD) { |
| 3168 // TODO(dbeam): handle this more gracefully. | 3167 // TODO(dbeam): handle this more gracefully. |
| 3169 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); | 3168 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); |
| 3170 } | 3169 } |
| 3171 } | 3170 } |
| 3172 SetIsSubmitting(false); | 3171 SetIsSubmitting(false); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3465 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3464 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3466 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3465 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3467 signin_helper_->StartWalletCookieValueFetch(); | 3466 signin_helper_->StartWalletCookieValueFetch(); |
| 3468 | 3467 |
| 3469 username_fetcher_.reset( | 3468 username_fetcher_.reset( |
| 3470 new wallet::WalletSigninHelper(this, request_context)); | 3469 new wallet::WalletSigninHelper(this, request_context)); |
| 3471 username_fetcher_->StartUserNameFetch(); | 3470 username_fetcher_->StartUserNameFetch(); |
| 3472 } | 3471 } |
| 3473 | 3472 |
| 3474 } // namespace autofill | 3473 } // namespace autofill |
| OLD | NEW |