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 #include <utility> | 10 #include <utility> |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 base::Bind(NullGetInfo), std::string(), | 523 base::Bind(NullGetInfo), std::string(), |
524 g_browser_process->GetApplicationLocale()); | 524 g_browser_process->GetApplicationLocale()); |
525 | 525 |
526 transaction_amount_ = form_structure_.GetUniqueValue( | 526 transaction_amount_ = form_structure_.GetUniqueValue( |
527 HTML_TYPE_TRANSACTION_AMOUNT); | 527 HTML_TYPE_TRANSACTION_AMOUNT); |
528 transaction_currency_ = form_structure_.GetUniqueValue( | 528 transaction_currency_ = form_structure_.GetUniqueValue( |
529 HTML_TYPE_TRANSACTION_CURRENCY); | 529 HTML_TYPE_TRANSACTION_CURRENCY); |
530 acceptable_cc_types_ = form_structure_.PossibleValues(CREDIT_CARD_TYPE); | 530 acceptable_cc_types_ = form_structure_.PossibleValues(CREDIT_CARD_TYPE); |
531 | 531 |
532 validator_.reset(new AddressValidator( | 532 validator_.reset(new AddressValidator( |
533 scoped_ptr< ::i18n::addressinput::Source>( | 533 std::unique_ptr<::i18n::addressinput::Source>( |
534 new autofill::ChromeMetadataSource(I18N_ADDRESS_VALIDATION_DATA_URL, | 534 new autofill::ChromeMetadataSource(I18N_ADDRESS_VALIDATION_DATA_URL, |
535 profile_->GetRequestContext())), | 535 profile_->GetRequestContext())), |
536 ValidationRulesStorageFactory::CreateStorage(), | 536 ValidationRulesStorageFactory::CreateStorage(), this)); |
537 this)); | |
538 | 537 |
539 SuggestionsUpdated(); | 538 SuggestionsUpdated(); |
540 SubmitButtonDelayBegin(); | 539 SubmitButtonDelayBegin(); |
541 view_.reset(CreateView()); | 540 view_.reset(CreateView()); |
542 view_->Show(); | 541 view_->Show(); |
543 GetManager()->AddObserver(this); | 542 GetManager()->AddObserver(this); |
544 | 543 |
545 LogDialogLatencyToShow(); | 544 LogDialogLatencyToShow(); |
546 } | 545 } |
547 | 546 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 GetValidator()->LoadRules( | 628 GetValidator()->LoadRules( |
630 CountryNames::GetInstance()->GetCountryCode(it->initial_value)); | 629 CountryNames::GetInstance()->GetCountryCode(it->initial_value)); |
631 } | 630 } |
632 } | 631 } |
633 } | 632 } |
634 | 633 |
635 void AutofillDialogControllerImpl::ShowEditUiIfBadSuggestion( | 634 void AutofillDialogControllerImpl::ShowEditUiIfBadSuggestion( |
636 DialogSection section) { | 635 DialogSection section) { |
637 // |CreateWrapper()| returns an empty wrapper if |IsEditingExistingData()|, so | 636 // |CreateWrapper()| returns an empty wrapper if |IsEditingExistingData()|, so |
638 // get the wrapper before this potentially happens below. | 637 // get the wrapper before this potentially happens below. |
639 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 638 std::unique_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
640 | 639 |
641 // If the chosen item in |model| yields an empty suggestion text, it is | 640 // If the chosen item in |model| yields an empty suggestion text, it is |
642 // invalid. In this case, show the edit UI and highlight invalid fields. | 641 // invalid. In this case, show the edit UI and highlight invalid fields. |
643 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); | 642 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); |
644 base::string16 unused, unused2; | 643 base::string16 unused, unused2; |
645 if (IsASuggestionItemKey(model->GetItemKeyForCheckedItem()) && | 644 if (IsASuggestionItemKey(model->GetItemKeyForCheckedItem()) && |
646 !SuggestionTextForSection(section, &unused, &unused2)) { | 645 !SuggestionTextForSection(section, &unused, &unused2)) { |
647 SetEditingExistingData(section, true); | 646 SetEditingExistingData(section, true); |
648 } | 647 } |
649 | 648 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 if (!IsASuggestionItemKey(item_key)) | 841 if (!IsASuggestionItemKey(item_key)) |
843 return false; | 842 return false; |
844 | 843 |
845 if (section == SECTION_BILLING || section == SECTION_SHIPPING) { | 844 if (section == SECTION_BILLING || section == SECTION_SHIPPING) { |
846 // Also check if the address is invalid (rules may have loaded since | 845 // Also check if the address is invalid (rules may have loaded since |
847 // the dialog was shown). | 846 // the dialog was shown). |
848 if (HasInvalidAddress(*GetManager()->GetProfileByGUID(item_key))) | 847 if (HasInvalidAddress(*GetManager()->GetProfileByGUID(item_key))) |
849 return false; | 848 return false; |
850 } | 849 } |
851 | 850 |
852 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 851 std::unique_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
853 return wrapper->GetDisplayText(vertically_compact, horizontally_compact); | 852 return wrapper->GetDisplayText(vertically_compact, horizontally_compact); |
854 } | 853 } |
855 | 854 |
856 base::string16 AutofillDialogControllerImpl::ExtraSuggestionTextForSection( | 855 base::string16 AutofillDialogControllerImpl::ExtraSuggestionTextForSection( |
857 DialogSection section) const { | 856 DialogSection section) const { |
858 if (section == SECTION_CC) | 857 if (section == SECTION_CC) |
859 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC); | 858 return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC); |
860 | 859 |
861 return base::string16(); | 860 return base::string16(); |
862 } | 861 } |
863 | 862 |
864 scoped_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( | 863 std::unique_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( |
865 DialogSection section) { | 864 DialogSection section) { |
866 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); | 865 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); |
867 std::string item_key = model->GetItemKeyForCheckedItem(); | 866 std::string item_key = model->GetItemKeyForCheckedItem(); |
868 if (!IsASuggestionItemKey(item_key) || IsManuallyEditingSection(section)) | 867 if (!IsASuggestionItemKey(item_key) || IsManuallyEditingSection(section)) |
869 return scoped_ptr<DataModelWrapper>(); | 868 return std::unique_ptr<DataModelWrapper>(); |
870 | 869 |
871 if (section == SECTION_CC) { | 870 if (section == SECTION_CC) { |
872 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key); | 871 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key); |
873 DCHECK(card); | 872 DCHECK(card); |
874 return scoped_ptr<DataModelWrapper>(new AutofillCreditCardWrapper(card)); | 873 return std::unique_ptr<DataModelWrapper>( |
| 874 new AutofillCreditCardWrapper(card)); |
875 } | 875 } |
876 | 876 |
877 AutofillProfile* profile = GetManager()->GetProfileByGUID(item_key); | 877 AutofillProfile* profile = GetManager()->GetProfileByGUID(item_key); |
878 DCHECK(profile); | 878 DCHECK(profile); |
879 if (section == SECTION_SHIPPING) { | 879 if (section == SECTION_SHIPPING) { |
880 return scoped_ptr<DataModelWrapper>( | 880 return std::unique_ptr<DataModelWrapper>( |
881 new AutofillShippingAddressWrapper(profile)); | 881 new AutofillShippingAddressWrapper(profile)); |
882 } | 882 } |
883 DCHECK_EQ(SECTION_BILLING, section); | 883 DCHECK_EQ(SECTION_BILLING, section); |
884 return scoped_ptr<DataModelWrapper>( | 884 return std::unique_ptr<DataModelWrapper>(new AutofillProfileWrapper(profile)); |
885 new AutofillProfileWrapper(profile)); | |
886 } | 885 } |
887 | 886 |
888 gfx::Image AutofillDialogControllerImpl::SuggestionIconForSection( | 887 gfx::Image AutofillDialogControllerImpl::SuggestionIconForSection( |
889 DialogSection section) { | 888 DialogSection section) { |
890 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); | 889 std::unique_ptr<DataModelWrapper> model = CreateWrapper(section); |
891 if (!model.get()) | 890 if (!model.get()) |
892 return gfx::Image(); | 891 return gfx::Image(); |
893 | 892 |
894 return model->GetIcon(); | 893 return model->GetIcon(); |
895 } | 894 } |
896 | 895 |
897 gfx::Image AutofillDialogControllerImpl::ExtraSuggestionIconForSection( | 896 gfx::Image AutofillDialogControllerImpl::ExtraSuggestionIconForSection( |
898 DialogSection section) { | 897 DialogSection section) { |
899 if (section != SECTION_CC) | 898 if (section != SECTION_CC) |
900 return gfx::Image(); | 899 return gfx::Image(); |
901 | 900 |
902 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); | 901 std::unique_ptr<DataModelWrapper> model = CreateWrapper(section); |
903 if (!model.get()) | 902 if (!model.get()) |
904 return gfx::Image(); | 903 return gfx::Image(); |
905 | 904 |
906 return CvcIconForCreditCardType( | 905 return CvcIconForCreditCardType( |
907 model->GetInfo(AutofillType(CREDIT_CARD_TYPE))); | 906 model->GetInfo(AutofillType(CREDIT_CARD_TYPE))); |
908 } | 907 } |
909 | 908 |
910 FieldIconMap AutofillDialogControllerImpl::IconsForFields( | 909 FieldIconMap AutofillDialogControllerImpl::IconsForFields( |
911 const FieldValueMap& user_inputs) const { | 910 const FieldValueMap& user_inputs) const { |
912 FieldIconMap result; | 911 FieldIconMap result; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 DialogSection section, | 1015 DialogSection section, |
1017 const FieldValueMap& inputs) { | 1016 const FieldValueMap& inputs) { |
1018 ValidityMessages messages; | 1017 ValidityMessages messages; |
1019 if (inputs.empty()) | 1018 if (inputs.empty()) |
1020 return messages; | 1019 return messages; |
1021 | 1020 |
1022 AddressValidator::Status status = AddressValidator::SUCCESS; | 1021 AddressValidator::Status status = AddressValidator::SUCCESS; |
1023 if (section != SECTION_CC) { | 1022 if (section != SECTION_CC) { |
1024 AutofillProfile profile; | 1023 AutofillProfile profile; |
1025 FillFormGroupFromOutputs(inputs, &profile); | 1024 FillFormGroupFromOutputs(inputs, &profile); |
1026 scoped_ptr<AddressData> address_data = | 1025 std::unique_ptr<AddressData> address_data = |
1027 i18n::CreateAddressDataFromAutofillProfile( | 1026 i18n::CreateAddressDataFromAutofillProfile( |
1028 profile, g_browser_process->GetApplicationLocale()); | 1027 profile, g_browser_process->GetApplicationLocale()); |
1029 address_data->language_code = AddressLanguageCodeForSection(section); | 1028 address_data->language_code = AddressLanguageCodeForSection(section); |
1030 | 1029 |
1031 Localization localization; | 1030 Localization localization; |
1032 localization.SetGetter(l10n_util::GetStringUTF8); | 1031 localization.SetGetter(l10n_util::GetStringUTF8); |
1033 FieldProblemMap problems; | 1032 FieldProblemMap problems; |
1034 status = GetValidator()->ValidateAddress(*address_data, NULL, &problems); | 1033 status = GetValidator()->ValidateAddress(*address_data, NULL, &problems); |
1035 bool billing = section != SECTION_SHIPPING; | 1034 bool billing = section != SECTION_SHIPPING; |
1036 | 1035 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 void AutofillDialogControllerImpl::DidAcceptSuggestion( | 1293 void AutofillDialogControllerImpl::DidAcceptSuggestion( |
1295 const base::string16& value, | 1294 const base::string16& value, |
1296 int identifier, | 1295 int identifier, |
1297 int position) { | 1296 int position) { |
1298 DCHECK_NE(UNKNOWN_TYPE, popup_input_type_); | 1297 DCHECK_NE(UNKNOWN_TYPE, popup_input_type_); |
1299 // Because |HidePopup()| can be called from |UpdateSection()|, remember the | 1298 // Because |HidePopup()| can be called from |UpdateSection()|, remember the |
1300 // type of the input for later here. | 1299 // type of the input for later here. |
1301 const ServerFieldType popup_input_type = popup_input_type_; | 1300 const ServerFieldType popup_input_type = popup_input_type_; |
1302 | 1301 |
1303 ScopedViewUpdates updates(view_.get()); | 1302 ScopedViewUpdates updates(view_.get()); |
1304 scoped_ptr<DataModelWrapper> wrapper; | 1303 std::unique_ptr<DataModelWrapper> wrapper; |
1305 | 1304 |
1306 if (static_cast<size_t>(identifier) < popup_suggestion_ids_.size()) { | 1305 if (static_cast<size_t>(identifier) < popup_suggestion_ids_.size()) { |
1307 const std::string& guid = popup_suggestion_ids_[identifier]; | 1306 const std::string& guid = popup_suggestion_ids_[identifier]; |
1308 if (IsCreditCardType(popup_input_type)) { | 1307 if (IsCreditCardType(popup_input_type)) { |
1309 wrapper.reset(new AutofillCreditCardWrapper( | 1308 wrapper.reset(new AutofillCreditCardWrapper( |
1310 GetManager()->GetCreditCardByGUID(guid))); | 1309 GetManager()->GetCreditCardByGUID(guid))); |
1311 } else { | 1310 } else { |
1312 wrapper.reset(new AutofillProfileWrapper( | 1311 wrapper.reset(new AutofillProfileWrapper( |
1313 GetManager()->GetProfileByGUID(guid))); | 1312 GetManager()->GetProfileByGUID(guid))); |
1314 } | 1313 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 const FormStructure::InputFieldComparator& compare) { | 1643 const FormStructure::InputFieldComparator& compare) { |
1645 if (!SectionIsActive(section)) | 1644 if (!SectionIsActive(section)) |
1646 return; | 1645 return; |
1647 | 1646 |
1648 DetailInputs inputs; | 1647 DetailInputs inputs; |
1649 std::string country_code = CountryCodeForSection(section); | 1648 std::string country_code = CountryCodeForSection(section); |
1650 BuildInputsForSection(section, country_code, &inputs, | 1649 BuildInputsForSection(section, country_code, &inputs, |
1651 MutableAddressLanguageCodeForSection(section)); | 1650 MutableAddressLanguageCodeForSection(section)); |
1652 std::vector<ServerFieldType> types = TypesFromInputs(inputs); | 1651 std::vector<ServerFieldType> types = TypesFromInputs(inputs); |
1653 | 1652 |
1654 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 1653 std::unique_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
1655 if (wrapper) { | 1654 if (wrapper) { |
1656 // Only fill in data that is associated with this section. | 1655 // Only fill in data that is associated with this section. |
1657 wrapper->FillFormStructure(types, compare, &form_structure_); | 1656 wrapper->FillFormStructure(types, compare, &form_structure_); |
1658 | 1657 |
1659 // CVC needs special-casing because the CreditCard class doesn't store or | 1658 // CVC needs special-casing because the CreditCard class doesn't store or |
1660 // handle them. This isn't necessary when filling the combined CC and | 1659 // handle them. This isn't necessary when filling the combined CC and |
1661 // billing section as CVC comes from |full_wallet_| in this case. | 1660 // billing section as CVC comes from |full_wallet_| in this case. |
1662 if (section == SECTION_CC) | 1661 if (section == SECTION_CC) |
1663 SetOutputForFieldsOfType(CREDIT_CARD_VERIFICATION_CODE, view_->GetCvc()); | 1662 SetOutputForFieldsOfType(CREDIT_CARD_VERIFICATION_CODE, view_->GetCvc()); |
1664 | 1663 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 if (field->Type().GetStorableType() == type) | 1724 if (field->Type().GetStorableType() == type) |
1726 field->value = output; | 1725 field->value = output; |
1727 } | 1726 } |
1728 } | 1727 } |
1729 | 1728 |
1730 base::string16 AutofillDialogControllerImpl::GetValueFromSection( | 1729 base::string16 AutofillDialogControllerImpl::GetValueFromSection( |
1731 DialogSection section, | 1730 DialogSection section, |
1732 ServerFieldType type) { | 1731 ServerFieldType type) { |
1733 DCHECK(SectionIsActive(section)); | 1732 DCHECK(SectionIsActive(section)); |
1734 | 1733 |
1735 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 1734 std::unique_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
1736 if (wrapper) | 1735 if (wrapper) |
1737 return wrapper->GetInfo(AutofillType(type)); | 1736 return wrapper->GetInfo(AutofillType(type)); |
1738 | 1737 |
1739 FieldValueMap output; | 1738 FieldValueMap output; |
1740 view_->GetUserInput(section, &output); | 1739 view_->GetUserInput(section, &output); |
1741 return output[type]; | 1740 return output[type]; |
1742 } | 1741 } |
1743 | 1742 |
1744 bool AutofillDialogControllerImpl::CanAcceptCountry( | 1743 bool AutofillDialogControllerImpl::CanAcceptCountry( |
1745 DialogSection section, | 1744 DialogSection section, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 AddressField focused_field; | 1813 AddressField focused_field; |
1815 if (!i18n::FieldForType(type, &focused_field)) | 1814 if (!i18n::FieldForType(type, &focused_field)) |
1816 return; | 1815 return; |
1817 | 1816 |
1818 FieldValueMap inputs; | 1817 FieldValueMap inputs; |
1819 view_->GetUserInput(section, &inputs); | 1818 view_->GetUserInput(section, &inputs); |
1820 | 1819 |
1821 AutofillProfile profile; | 1820 AutofillProfile profile; |
1822 FillFormGroupFromOutputs(inputs, &profile); | 1821 FillFormGroupFromOutputs(inputs, &profile); |
1823 | 1822 |
1824 scoped_ptr<AddressData> user_input = | 1823 std::unique_ptr<AddressData> user_input = |
1825 i18n::CreateAddressDataFromAutofillProfile( | 1824 i18n::CreateAddressDataFromAutofillProfile( |
1826 profile, g_browser_process->GetApplicationLocale()); | 1825 profile, g_browser_process->GetApplicationLocale()); |
1827 user_input->language_code = AddressLanguageCodeForSection(section); | 1826 user_input->language_code = AddressLanguageCodeForSection(section); |
1828 | 1827 |
1829 static const size_t kSuggestionsLimit = 10; | 1828 static const size_t kSuggestionsLimit = 10; |
1830 AddressValidator::Status status = GetValidator()->GetSuggestions( | 1829 AddressValidator::Status status = GetValidator()->GetSuggestions( |
1831 *user_input, focused_field, kSuggestionsLimit, | 1830 *user_input, focused_field, kSuggestionsLimit, |
1832 &i18n_validator_suggestions_); | 1831 &i18n_validator_suggestions_); |
1833 | 1832 |
1834 if (status != AddressValidator::SUCCESS) | 1833 if (status != AddressValidator::SUCCESS) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1880 |
1882 std::vector<ServerFieldType> AutofillDialogControllerImpl:: | 1881 std::vector<ServerFieldType> AutofillDialogControllerImpl:: |
1883 RequestedTypesForSection(DialogSection section) const { | 1882 RequestedTypesForSection(DialogSection section) const { |
1884 return TypesFromInputs(RequestedFieldsForSection(section)); | 1883 return TypesFromInputs(RequestedFieldsForSection(section)); |
1885 } | 1884 } |
1886 | 1885 |
1887 std::string AutofillDialogControllerImpl::CountryCodeForSection( | 1886 std::string AutofillDialogControllerImpl::CountryCodeForSection( |
1888 DialogSection section) { | 1887 DialogSection section) { |
1889 base::string16 country; | 1888 base::string16 country; |
1890 | 1889 |
1891 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 1890 std::unique_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
1892 if (wrapper) { | 1891 if (wrapper) { |
1893 country = wrapper->GetInfo(AutofillType(CountryTypeForSection(section))); | 1892 country = wrapper->GetInfo(AutofillType(CountryTypeForSection(section))); |
1894 } else { | 1893 } else { |
1895 FieldValueMap outputs; | 1894 FieldValueMap outputs; |
1896 view_->GetUserInput(section, &outputs); | 1895 view_->GetUserInput(section, &outputs); |
1897 country = outputs[CountryTypeForSection(section)]; | 1896 country = outputs[CountryTypeForSection(section)]; |
1898 } | 1897 } |
1899 | 1898 |
1900 return CountryNames::GetInstance()->GetCountryCode(country); | 1899 return CountryNames::GetInstance()->GetCountryCode(country); |
1901 } | 1900 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 if (acceptable_cc_types_.find(base::i18n::ToUpper(type)) == | 2028 if (acceptable_cc_types_.find(base::i18n::ToUpper(type)) == |
2030 acceptable_cc_types_.end()) { | 2029 acceptable_cc_types_.end()) { |
2031 return true; | 2030 return true; |
2032 } | 2031 } |
2033 | 2032 |
2034 return false; | 2033 return false; |
2035 } | 2034 } |
2036 | 2035 |
2037 bool AutofillDialogControllerImpl::HasInvalidAddress( | 2036 bool AutofillDialogControllerImpl::HasInvalidAddress( |
2038 const AutofillProfile& profile) { | 2037 const AutofillProfile& profile) { |
2039 scoped_ptr<AddressData> address_data = | 2038 std::unique_ptr<AddressData> address_data = |
2040 i18n::CreateAddressDataFromAutofillProfile( | 2039 i18n::CreateAddressDataFromAutofillProfile( |
2041 profile, g_browser_process->GetApplicationLocale()); | 2040 profile, g_browser_process->GetApplicationLocale()); |
2042 | 2041 |
2043 FieldProblemMap problems; | 2042 FieldProblemMap problems; |
2044 GetValidator()->ValidateAddress(*address_data, NULL, &problems); | 2043 GetValidator()->ValidateAddress(*address_data, NULL, &problems); |
2045 return !problems.empty(); | 2044 return !problems.empty(); |
2046 } | 2045 } |
2047 | 2046 |
2048 bool AutofillDialogControllerImpl::ShouldUseBillingForShipping() { | 2047 bool AutofillDialogControllerImpl::ShouldUseBillingForShipping() { |
2049 return SectionIsActive(SECTION_SHIPPING) && | 2048 return SectionIsActive(SECTION_SHIPPING) && |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 ShowEditUiIfBadSuggestion(section); | 2130 ShowEditUiIfBadSuggestion(section); |
2132 UpdateSection(section); | 2131 UpdateSection(section); |
2133 } | 2132 } |
2134 } | 2133 } |
2135 } | 2134 } |
2136 | 2135 |
2137 void AutofillDialogControllerImpl::PersistAutofillChoice( | 2136 void AutofillDialogControllerImpl::PersistAutofillChoice( |
2138 DialogSection section, | 2137 DialogSection section, |
2139 const std::string& guid) { | 2138 const std::string& guid) { |
2140 DCHECK(ShouldOfferToSaveInChrome()); | 2139 DCHECK(ShouldOfferToSaveInChrome()); |
2141 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 2140 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
2142 value->SetString(kGuidPrefKey, guid); | 2141 value->SetString(kGuidPrefKey, guid); |
2143 | 2142 |
2144 DictionaryPrefUpdate updater(profile()->GetPrefs(), | 2143 DictionaryPrefUpdate updater(profile()->GetPrefs(), |
2145 ::prefs::kAutofillDialogAutofillDefault); | 2144 ::prefs::kAutofillDialogAutofillDefault); |
2146 base::DictionaryValue* autofill_choice = updater.Get(); | 2145 base::DictionaryValue* autofill_choice = updater.Get(); |
2147 autofill_choice->Set(SectionToPrefString(section), value.release()); | 2146 autofill_choice->Set(SectionToPrefString(section), value.release()); |
2148 } | 2147 } |
2149 | 2148 |
2150 void AutofillDialogControllerImpl::GetDefaultAutofillChoice( | 2149 void AutofillDialogControllerImpl::GetDefaultAutofillChoice( |
2151 DialogSection section, | 2150 DialogSection section, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 } | 2262 } |
2264 | 2263 |
2265 void AutofillDialogControllerImpl::OnSubmitButtonDelayEnd() { | 2264 void AutofillDialogControllerImpl::OnSubmitButtonDelayEnd() { |
2266 if (!view_) | 2265 if (!view_) |
2267 return; | 2266 return; |
2268 ScopedViewUpdates updates(view_.get()); | 2267 ScopedViewUpdates updates(view_.get()); |
2269 view_->UpdateButtonStrip(); | 2268 view_->UpdateButtonStrip(); |
2270 } | 2269 } |
2271 | 2270 |
2272 } // namespace autofill | 2271 } // namespace autofill |
OLD | NEW |