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

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

Issue 145553009: rAc: use libaddressinput to validate international addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 10 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
11 #include "apps/shell_window.h" 11 #include "apps/shell_window.h"
12 #include "apps/shell_window_registry.h" 12 #include "apps/shell_window_registry.h"
13 #include "apps/ui/native_app_window.h" 13 #include "apps/ui/native_app_window.h"
14 #include "base/base64.h" 14 #include "base/base64.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/i18n/case_conversion.h" 16 #include "base/i18n/case_conversion.h"
17 #include "base/i18n/rtl.h" 17 #include "base/i18n/rtl.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/prefs/pref_registry_simple.h" 19 #include "base/prefs/pref_registry_simple.h"
20 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
21 #include "base/prefs/scoped_user_pref_update.h" 21 #include "base/prefs/scoped_user_pref_update.h"
22 #include "base/rand_util.h" 22 #include "base/rand_util.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "chrome/browser/autofill/personal_data_manager_factory.h" 28 #include "chrome/browser/autofill/personal_data_manager_factory.h"
29 #include "chrome/browser/autofill/validation_rules_storage_factory.h"
29 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" 32 #include "chrome/browser/ui/autofill/autofill_dialog_common.h"
32 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" 33 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
33 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" 34 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
34 #include "chrome/browser/ui/autofill/data_model_wrapper.h" 35 #include "chrome/browser/ui/autofill/data_model_wrapper.h"
36 #include "chrome/browser/ui/autofill/field_map_wrapper.h"
35 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" 37 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h"
36 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" 38 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h"
37 #include "chrome/browser/ui/browser.h" 39 #include "chrome/browser/ui/browser.h"
38 #include "chrome/browser/ui/browser_finder.h" 40 #include "chrome/browser/ui/browser_finder.h"
39 #include "chrome/browser/ui/browser_navigator.h" 41 #include "chrome/browser/ui/browser_navigator.h"
40 #include "chrome/browser/ui/browser_window.h" 42 #include "chrome/browser/ui/browser_window.h"
41 #include "chrome/common/chrome_version_info.h" 43 #include "chrome/common/chrome_version_info.h"
42 #include "chrome/common/pref_names.h" 44 #include "chrome/common/pref_names.h"
43 #include "chrome/common/render_messages.h" 45 #include "chrome/common/render_messages.h"
44 #include "chrome/common/url_constants.h" 46 #include "chrome/common/url_constants.h"
(...skipping 27 matching lines...) Expand all
72 #include "content/public/browser/web_contents.h" 74 #include "content/public/browser/web_contents.h"
73 #include "content/public/browser/web_contents_view.h" 75 #include "content/public/browser/web_contents_view.h"
74 #include "content/public/common/url_constants.h" 76 #include "content/public/common/url_constants.h"
75 #include "grit/chromium_strings.h" 77 #include "grit/chromium_strings.h"
76 #include "grit/component_strings.h" 78 #include "grit/component_strings.h"
77 #include "grit/generated_resources.h" 79 #include "grit/generated_resources.h"
78 #include "grit/platform_locale_settings.h" 80 #include "grit/platform_locale_settings.h"
79 #include "grit/theme_resources.h" 81 #include "grit/theme_resources.h"
80 #include "grit/webkit_resources.h" 82 #include "grit/webkit_resources.h"
81 #include "net/cert/cert_status_flags.h" 83 #include "net/cert/cert_status_flags.h"
84 #include "third_party/libaddressinput/chromium/chrome_downloader_impl.h"
85 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h"
86 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h"
87 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_problem.h"
82 #include "ui/base/base_window.h" 88 #include "ui/base/base_window.h"
83 #include "ui/base/l10n/l10n_util.h" 89 #include "ui/base/l10n/l10n_util.h"
84 #include "ui/base/models/combobox_model.h" 90 #include "ui/base/models/combobox_model.h"
85 #include "ui/base/resource/resource_bundle.h" 91 #include "ui/base/resource/resource_bundle.h"
86 #include "ui/events/event.h" 92 #include "ui/events/event.h"
87 #include "ui/gfx/canvas.h" 93 #include "ui/gfx/canvas.h"
88 #include "ui/gfx/image/image_skia_operations.h" 94 #include "ui/gfx/image/image_skia_operations.h"
89 #include "ui/gfx/skia_util.h" 95 #include "ui/gfx/skia_util.h"
90 96
97 using ::i18n::addressinput::AddressData;
98 using ::i18n::addressinput::AddressField;
99 using ::i18n::addressinput::AddressProblem;
100 using ::i18n::addressinput::AddressProblemFilter;
101 using ::i18n::addressinput::AddressProblems;
102 using ::i18n::addressinput::AddressValidator;
103
91 namespace autofill { 104 namespace autofill {
92 105
93 namespace { 106 namespace {
94 107
95 const char kAddNewItemKey[] = "add-new-item"; 108 const char kAddNewItemKey[] = "add-new-item";
96 const char kManageItemsKey[] = "manage-items"; 109 const char kManageItemsKey[] = "manage-items";
97 const char kSameAsBillingKey[] = "same-as-billing"; 110 const char kSameAsBillingKey[] = "same-as-billing";
98 111
99 // URLs for Wallet error messages. 112 // URLs for Wallet error messages.
100 const char kBuyerLegalAddressStatusUrl[] = 113 const char kBuyerLegalAddressStatusUrl[] =
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 624
612 account_chooser_model_.reset( 625 account_chooser_model_.reset(
613 new AccountChooserModel(this, 626 new AccountChooserModel(this,
614 profile_, 627 profile_,
615 !ShouldShowAccountChooser(), 628 !ShouldShowAccountChooser(),
616 metric_logger_)); 629 metric_logger_));
617 630
618 if (account_chooser_model_->WalletIsSelected()) 631 if (account_chooser_model_->WalletIsSelected())
619 FetchWalletCookie(); 632 FetchWalletCookie();
620 633
634 if (i18ninput::Enabled()) {
635 scoped_ptr< ::i18n::addressinput::Downloader> downloader(
636 new autofill::ChromeDownloaderImpl(profile_->GetRequestContext()));
637 validator_ = AddressValidator::Build(
638 downloader.Pass(),
639 ValidationRulesStorageFactory::CreateStorage(),
640 this);
641 validator_->LoadRules(GetManager()->GetDefaultCountryCodeForNewAddress());
642 }
643
621 // TODO(estade): don't show the dialog if the site didn't specify the right 644 // TODO(estade): don't show the dialog if the site didn't specify the right
622 // fields. First we must figure out what the "right" fields are. 645 // fields. First we must figure out what the "right" fields are.
623 SuggestionsUpdated(); 646 SuggestionsUpdated();
624 SubmitButtonDelayBegin(); 647 SubmitButtonDelayBegin();
625 view_.reset(CreateView()); 648 view_.reset(CreateView());
626 view_->Show(); 649 view_->Show();
627 GetManager()->AddObserver(this); 650 GetManager()->AddObserver(this);
628 651
629 if (!account_chooser_model_->WalletIsSelected()) 652 if (!account_chooser_model_->WalletIsSelected())
630 LogDialogLatencyToShow(); 653 LogDialogLatencyToShow();
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 } 1182 }
1160 1183
1161 return snapshot; 1184 return snapshot;
1162 } 1185 }
1163 1186
1164 void AutofillDialogControllerImpl::RestoreUserInputFromSnapshot( 1187 void AutofillDialogControllerImpl::RestoreUserInputFromSnapshot(
1165 const FieldValueMap& snapshot) { 1188 const FieldValueMap& snapshot) {
1166 if (snapshot.empty()) 1189 if (snapshot.empty())
1167 return; 1190 return;
1168 1191
1169 FieldMapWrapper wrapper(snapshot);
1170 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { 1192 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
1171 DialogSection section = static_cast<DialogSection>(i); 1193 DialogSection section = static_cast<DialogSection>(i);
1172 if (!SectionIsActive(section)) 1194 if (!SectionIsActive(section))
1173 continue; 1195 continue;
1174 1196
1175 DetailInputs* inputs = MutableRequestedFieldsForSection(section); 1197 DetailInputs* inputs = MutableRequestedFieldsForSection(section);
1176 wrapper.FillInputs(inputs); 1198 FieldMapWrapper(snapshot, section).FillInputs(inputs);
1177 1199
1178 for (size_t i = 0; i < inputs->size(); ++i) { 1200 for (size_t i = 0; i < inputs->size(); ++i) {
1179 if (InputWasEdited((*inputs)[i].type, (*inputs)[i].initial_value)) { 1201 if (InputWasEdited((*inputs)[i].type, (*inputs)[i].initial_value)) {
1180 SuggestionsMenuModelForSection(section)->SetCheckedItem(kAddNewItemKey); 1202 SuggestionsMenuModelForSection(section)->SetCheckedItem(kAddNewItemKey);
1181 break; 1203 break;
1182 } 1204 }
1183 } 1205 }
1184 } 1206 }
1185 } 1207 }
1186 1208
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 if (it != wallet_errors_.end()) { 1667 if (it != wallet_errors_.end()) {
1646 TypeErrorInputMap::const_iterator iter = it->second.find(type); 1668 TypeErrorInputMap::const_iterator iter = it->second.find(type);
1647 if (iter != it->second.end()) { 1669 if (iter != it->second.end()) {
1648 if (iter->second.second == value) 1670 if (iter->second.second == value)
1649 return iter->second.first; 1671 return iter->second.first;
1650 it->second.erase(type); 1672 it->second.erase(type);
1651 } 1673 }
1652 } 1674 }
1653 } 1675 }
1654 1676
1655 switch (AutofillType(type).GetStorableType()) { 1677 AutofillType autofill_type(type);
1678 if (i18ninput::Enabled() &&
1679 (autofill_type.group() == ADDRESS_HOME ||
1680 autofill_type.group() == ADDRESS_BILLING)) {
1681 return base::string16();
1682 }
1683
1684 switch (autofill_type.GetStorableType()) {
1656 case EMAIL_ADDRESS: 1685 case EMAIL_ADDRESS:
1657 if (!value.empty() && !IsValidEmailAddress(value)) { 1686 if (!value.empty() && !IsValidEmailAddress(value)) {
1658 return l10n_util::GetStringUTF16( 1687 return l10n_util::GetStringUTF16(
1659 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_EMAIL_ADDRESS); 1688 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_EMAIL_ADDRESS);
1660 } 1689 }
1661 break; 1690 break;
1662 1691
1663 case CREDIT_CARD_NUMBER: { 1692 case CREDIT_CARD_NUMBER: {
1664 if (!value.empty()) { 1693 if (!value.empty()) {
1665 base::string16 message = CreditCardNumberValidityMessage(value); 1694 base::string16 message = CreditCardNumberValidityMessage(value);
(...skipping 30 matching lines...) Expand all
1696 case ADDRESS_HOME_LINE2: 1725 case ADDRESS_HOME_LINE2:
1697 case ADDRESS_HOME_DEPENDENT_LOCALITY: 1726 case ADDRESS_HOME_DEPENDENT_LOCALITY:
1698 case ADDRESS_HOME_SORTING_CODE: 1727 case ADDRESS_HOME_SORTING_CODE:
1699 return base::string16(); // Optional until we have better validation. 1728 return base::string16(); // Optional until we have better validation.
1700 1729
1701 case ADDRESS_HOME_CITY: 1730 case ADDRESS_HOME_CITY:
1702 case ADDRESS_HOME_COUNTRY: 1731 case ADDRESS_HOME_COUNTRY:
1703 break; 1732 break;
1704 1733
1705 case ADDRESS_HOME_STATE: 1734 case ADDRESS_HOME_STATE:
1706 if (!value.empty() && !autofill::IsValidState(value) && 1735 if (!value.empty() &&!autofill::IsValidState(value) &&
1707 CountryCodeForSection(section) == "US") { 1736 CountryCodeForSection(section) == "US") {
1737 DCHECK(!i18ninput::Enabled());
1708 return l10n_util::GetStringUTF16( 1738 return l10n_util::GetStringUTF16(
1709 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_REGION); 1739 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_REGION);
1710 } 1740 }
1711 break; 1741 break;
1712 1742
1713 case ADDRESS_HOME_ZIP: 1743 case ADDRESS_HOME_ZIP:
1714 if (!value.empty() && !autofill::IsValidZip(value) && 1744 if (!value.empty() && !autofill::IsValidZip(value) &&
1715 CountryCodeForSection(section) == "US") { 1745 CountryCodeForSection(section) == "US") {
1746 DCHECK(!i18ninput::Enabled());
1716 return l10n_util::GetStringUTF16( 1747 return l10n_util::GetStringUTF16(
1717 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_ZIP_CODE); 1748 IDS_AUTOFILL_DIALOG_VALIDATION_INVALID_ZIP_CODE);
1718 } 1749 }
1719 break; 1750 break;
1720 1751
1721 case NAME_FULL: 1752 case NAME_FULL:
1722 // Wallet requires a first and last billing name. 1753 // Wallet requires a first and last billing name.
1723 if (section == SECTION_CC_BILLING && !value.empty() && 1754 if (section == SECTION_CC_BILLING && !value.empty() &&
1724 !IsCardHolderNameValidForWallet(value)) { 1755 !IsCardHolderNameValidForWallet(value)) {
1725 DCHECK(IsPayingWithWallet()); 1756 DCHECK(IsPayingWithWallet());
(...skipping 16 matching lines...) Expand all
1742 return value.empty() ? 1773 return value.empty() ?
1743 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VALIDATION_MISSING_VALUE) : 1774 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VALIDATION_MISSING_VALUE) :
1744 base::string16(); 1775 base::string16();
1745 } 1776 }
1746 1777
1747 // TODO(groby): Also add tests. 1778 // TODO(groby): Also add tests.
1748 ValidityMessages AutofillDialogControllerImpl::InputsAreValid( 1779 ValidityMessages AutofillDialogControllerImpl::InputsAreValid(
1749 DialogSection section, 1780 DialogSection section,
1750 const FieldValueMap& inputs) { 1781 const FieldValueMap& inputs) {
1751 ValidityMessages messages; 1782 ValidityMessages messages;
1783 if (inputs.empty())
1784 return messages;
1785
1752 FieldValueMap field_values; 1786 FieldValueMap field_values;
1787
1788 if (i18ninput::Enabled() && section != SECTION_CC) {
1789 AddressProblems problems;
1790 FieldMapWrapper wrapper(inputs, section);
1791 AddressData address_data = i18ninput::CreateAddressData(
1792 base::Bind(&FieldMapWrapper::GetInfo, base::Unretained(&wrapper)));
1793 DCHECK_EQ(2U, address_data.country_code.size());
1794 if (validator_->ValidateAddress(address_data,
1795 AddressProblemFilter(),
1796 &problems) == AddressValidator::SUCCESS) {
1797 common::AddressType address_type = section == SECTION_SHIPPING ?
1798 common::ADDRESS_TYPE_SHIPPING : common::ADDRESS_TYPE_BILLING;
1799 for (size_t i = 0; i < problems.size(); ++i) {
1800 const AddressProblem& problem = problems[i];
1801 bool sure = problem.type != AddressProblem::MISSING_REQUIRED_FIELD;
1802 base::string16 text = l10n_util::GetStringUTF16(problem.description_id);
1803 messages.Set(i18ninput::TypeForField(problem.field, address_type),
1804 ValidityMessage(text, sure));
1805 }
1806 }
1807 }
1808
1753 for (FieldValueMap::const_iterator iter = inputs.begin(); 1809 for (FieldValueMap::const_iterator iter = inputs.begin();
1754 iter != inputs.end(); ++iter) { 1810 iter != inputs.end(); ++iter) {
1755 const ServerFieldType type = iter->first; 1811 const ServerFieldType type = iter->first;
1812 if (!messages.GetMessageOrDefault(type).text.empty())
1813 continue;
1756 1814
1757 base::string16 text = InputValidityMessage(section, type, iter->second); 1815 base::string16 text = InputValidityMessage(section, type, iter->second);
1758 1816
1759 // Skip empty/unchanged fields in edit mode. Ignore country as it always has 1817 // Skip empty/unchanged fields in edit mode. Ignore country as it always has
1760 // a value. If the individual field does not have validation errors, assume 1818 // a value. If the individual field does not have validation errors, assume
1761 // it to be valid unless later proven otherwise. 1819 // it to be valid unless later proven otherwise.
1762 bool sure = InputWasEdited(type, iter->second) || 1820 bool sure = InputWasEdited(type, iter->second) ||
1763 AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY; 1821 AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY;
1764 1822
1765 // Consider only individually valid fields for inter-field validation. 1823 // Consider only individually valid fields for inter-field validation.
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 handling_use_wallet_link_click_(false), 2630 handling_use_wallet_link_click_(false),
2573 passive_failed_(false), 2631 passive_failed_(false),
2574 billing_country_combobox_model_(*GetManager()), 2632 billing_country_combobox_model_(*GetManager()),
2575 shipping_country_combobox_model_(*GetManager()), 2633 shipping_country_combobox_model_(*GetManager()),
2576 suggested_cc_(this), 2634 suggested_cc_(this),
2577 suggested_billing_(this), 2635 suggested_billing_(this),
2578 suggested_cc_billing_(this), 2636 suggested_cc_billing_(this),
2579 suggested_shipping_(this), 2637 suggested_shipping_(this),
2580 cares_about_shipping_(true), 2638 cares_about_shipping_(true),
2581 popup_input_type_(UNKNOWN_TYPE), 2639 popup_input_type_(UNKNOWN_TYPE),
2582 weak_ptr_factory_(this),
2583 waiting_for_explicit_sign_in_response_(false), 2640 waiting_for_explicit_sign_in_response_(false),
2584 has_accepted_legal_documents_(false), 2641 has_accepted_legal_documents_(false),
2585 is_submitting_(false), 2642 is_submitting_(false),
2586 choose_another_instrument_or_address_(false), 2643 choose_another_instrument_or_address_(false),
2587 wallet_server_validation_recoverable_(true), 2644 wallet_server_validation_recoverable_(true),
2588 data_was_passed_back_(false), 2645 data_was_passed_back_(false),
2589 was_ui_latency_logged_(false), 2646 was_ui_latency_logged_(false),
2590 card_generated_animation_(2000, 60, this) { 2647 card_generated_animation_(2000, 60, this),
2648 weak_ptr_factory_(this) {
2591 // TODO(estade): remove duplicates from |form_structure|? 2649 // TODO(estade): remove duplicates from |form_structure|?
2592 DCHECK(!callback_.is_null()); 2650 DCHECK(!callback_.is_null());
2593 } 2651 }
2594 2652
2595 AutofillDialogView* AutofillDialogControllerImpl::CreateView() { 2653 AutofillDialogView* AutofillDialogControllerImpl::CreateView() {
2596 return AutofillDialogView::Create(this); 2654 return AutofillDialogView::Create(this);
2597 } 2655 }
2598 2656
2599 PersonalDataManager* AutofillDialogControllerImpl::GetManager() const { 2657 PersonalDataManager* AutofillDialogControllerImpl::GetManager() const {
2600 return PersonalDataManagerFactory::GetForProfile(profile_); 2658 return PersonalDataManagerFactory::GetForProfile(profile_);
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 if (outputs[CountryTypeForSection(section)] == country_name) 3160 if (outputs[CountryTypeForSection(section)] == country_name)
3103 return false; 3161 return false;
3104 } 3162 }
3105 3163
3106 DetailInputs* inputs = MutableRequestedFieldsForSection(section); 3164 DetailInputs* inputs = MutableRequestedFieldsForSection(section);
3107 inputs->clear(); 3165 inputs->clear();
3108 3166
3109 std::string country_code = AutofillCountry::GetCountryCode( 3167 std::string country_code = AutofillCountry::GetCountryCode(
3110 country_name, g_browser_process->GetApplicationLocale()); 3168 country_name, g_browser_process->GetApplicationLocale());
3111 common::BuildInputsForSection(section, country_code, inputs); 3169 common::BuildInputsForSection(section, country_code, inputs);
3170
3171 if (i18ninput::Enabled())
3172 validator_->LoadRules(country_code);
3173
3112 return true; 3174 return true;
3113 } 3175 }
3114 3176
3115 void AutofillDialogControllerImpl::HidePopup() { 3177 void AutofillDialogControllerImpl::HidePopup() {
3116 if (popup_controller_.get()) 3178 if (popup_controller_.get())
3117 popup_controller_->Hide(); 3179 popup_controller_->Hide();
3118 popup_input_type_ = UNKNOWN_TYPE; 3180 popup_input_type_ = UNKNOWN_TYPE;
3119 } 3181 }
3120 3182
3121 void AutofillDialogControllerImpl::SetEditingExistingData( 3183 void AutofillDialogControllerImpl::SetEditingExistingData(
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 DCHECK_EQ(animation, &card_generated_animation_); 3457 DCHECK_EQ(animation, &card_generated_animation_);
3396 PushOverlayUpdate(); 3458 PushOverlayUpdate();
3397 } 3459 }
3398 3460
3399 void AutofillDialogControllerImpl::AnimationEnded( 3461 void AutofillDialogControllerImpl::AnimationEnded(
3400 const gfx::Animation* animation) { 3462 const gfx::Animation* animation) {
3401 DCHECK_EQ(animation, &card_generated_animation_); 3463 DCHECK_EQ(animation, &card_generated_animation_);
3402 DoFinishSubmit(); 3464 DoFinishSubmit();
3403 } 3465 }
3404 3466
3467 void AutofillDialogControllerImpl::OnAddressValidationRulesLoaded(
3468 const std::string& country_code,
3469 bool success) {
3470 // TODO(dbeam): ask |view_| to re-validate its contents if necessary.
3471 }
3472
3405 void AutofillDialogControllerImpl::DoFinishSubmit() { 3473 void AutofillDialogControllerImpl::DoFinishSubmit() {
3406 FillOutputForSection(SECTION_CC); 3474 FillOutputForSection(SECTION_CC);
3407 FillOutputForSection(SECTION_BILLING); 3475 FillOutputForSection(SECTION_BILLING);
3408 FillOutputForSection(SECTION_CC_BILLING); 3476 FillOutputForSection(SECTION_CC_BILLING);
3409 3477
3410 if (ShouldUseBillingForShipping()) { 3478 if (ShouldUseBillingForShipping()) {
3411 FillOutputForSectionWithComparator( 3479 FillOutputForSectionWithComparator(
3412 SECTION_BILLING, 3480 SECTION_BILLING,
3413 base::Bind(ServerTypeMatchesShippingField)); 3481 base::Bind(ServerTypeMatchesShippingField));
3414 FillOutputForSectionWithComparator( 3482 FillOutputForSectionWithComparator(
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3652 view_->UpdateButtonStrip(); 3720 view_->UpdateButtonStrip();
3653 } 3721 }
3654 3722
3655 void AutofillDialogControllerImpl::FetchWalletCookie() { 3723 void AutofillDialogControllerImpl::FetchWalletCookie() {
3656 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 3724 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
3657 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 3725 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
3658 signin_helper_->StartWalletCookieValueFetch(); 3726 signin_helper_->StartWalletCookieValueFetch();
3659 } 3727 }
3660 3728
3661 } // namespace autofill 3729 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698