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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | 2683 profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), |
2684 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), | 2684 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
2685 form_structure_(form_structure), | 2685 form_structure_(form_structure), |
2686 invoked_from_same_origin_(true), | 2686 invoked_from_same_origin_(true), |
2687 source_url_(source_url), | 2687 source_url_(source_url), |
2688 callback_(callback), | 2688 callback_(callback), |
2689 wallet_client_(profile_->GetRequestContext(), this, source_url), | 2689 wallet_client_(profile_->GetRequestContext(), this, source_url), |
2690 wallet_items_requested_(false), | 2690 wallet_items_requested_(false), |
2691 handling_use_wallet_link_click_(false), | 2691 handling_use_wallet_link_click_(false), |
2692 passive_failed_(false), | 2692 passive_failed_(false), |
2693 billing_country_combobox_model_(*GetManager()), | 2693 billing_country_combobox_model_(*GetManager(), false), |
2694 shipping_country_combobox_model_(*GetManager()), | 2694 shipping_country_combobox_model_(*GetManager(), false), |
2695 suggested_cc_(this), | 2695 suggested_cc_(this), |
2696 suggested_billing_(this), | 2696 suggested_billing_(this), |
2697 suggested_cc_billing_(this), | 2697 suggested_cc_billing_(this), |
2698 suggested_shipping_(this), | 2698 suggested_shipping_(this), |
2699 cares_about_shipping_(true), | 2699 cares_about_shipping_(true), |
2700 popup_input_type_(UNKNOWN_TYPE), | 2700 popup_input_type_(UNKNOWN_TYPE), |
2701 waiting_for_explicit_sign_in_response_(false), | 2701 waiting_for_explicit_sign_in_response_(false), |
2702 has_accepted_legal_documents_(false), | 2702 has_accepted_legal_documents_(false), |
2703 is_submitting_(false), | 2703 is_submitting_(false), |
2704 choose_another_instrument_or_address_(false), | 2704 choose_another_instrument_or_address_(false), |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2930 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); | 2930 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); |
2931 } | 2931 } |
2932 | 2932 |
2933 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); | 2933 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); |
2934 std::vector<base::string16> labels; | 2934 std::vector<base::string16> labels; |
2935 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); | 2935 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); |
2936 DCHECK_EQ(labels.size(), profiles.size()); | 2936 DCHECK_EQ(labels.size(), profiles.size()); |
2937 for (size_t i = 0; i < profiles.size(); ++i) { | 2937 for (size_t i = 0; i < profiles.size(); ++i) { |
2938 const AutofillProfile& profile = *profiles[i]; | 2938 const AutofillProfile& profile = *profiles[i]; |
2939 if (!i18ninput::AddressHasCompleteAndVerifiedData(profile) || | 2939 if (!i18ninput::AddressHasCompleteAndVerifiedData(profile) || |
| 2940 !i18ninput::CountryIsFullySupported( |
| 2941 UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))) || |
2940 (!i18ninput::Enabled() && HasInvalidAddress(*profiles[i]))) { | 2942 (!i18ninput::Enabled() && HasInvalidAddress(*profiles[i]))) { |
2941 continue; | 2943 continue; |
2942 } | 2944 } |
2943 | 2945 |
2944 // Don't add variants for addresses: name is part of credit card and we'll | 2946 // Don't add variants for addresses: name is part of credit card and we'll |
2945 // just ignore email and phone number variants. | 2947 // just ignore email and phone number variants. |
2946 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); | 2948 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); |
2947 if (!profile.GetRawInfo(EMAIL_ADDRESS).empty() && | 2949 if (!profile.GetRawInfo(EMAIL_ADDRESS).empty() && |
2948 !profile.IsPresentButInvalid(EMAIL_ADDRESS)) { | 2950 !profile.IsPresentButInvalid(EMAIL_ADDRESS)) { |
2949 suggested_billing_.AddKeyedItem(profile.guid(), labels[i]); | 2951 suggested_billing_.AddKeyedItem(profile.guid(), labels[i]); |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 view_->UpdateButtonStrip(); | 3816 view_->UpdateButtonStrip(); |
3815 } | 3817 } |
3816 | 3818 |
3817 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3819 void AutofillDialogControllerImpl::FetchWalletCookie() { |
3818 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3820 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
3819 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3821 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
3820 signin_helper_->StartWalletCookieValueFetch(); | 3822 signin_helper_->StartWalletCookieValueFetch(); |
3821 } | 3823 } |
3822 | 3824 |
3823 } // namespace autofill | 3825 } // namespace autofill |
OLD | NEW |