| 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 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2917 } | 2917 } |
| 2918 | 2918 |
| 2919 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); | 2919 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); |
| 2920 std::vector<base::string16> labels; | 2920 std::vector<base::string16> labels; |
| 2921 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); | 2921 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); |
| 2922 DCHECK_EQ(labels.size(), profiles.size()); | 2922 DCHECK_EQ(labels.size(), profiles.size()); |
| 2923 for (size_t i = 0; i < profiles.size(); ++i) { | 2923 for (size_t i = 0; i < profiles.size(); ++i) { |
| 2924 const AutofillProfile& profile = *profiles[i]; | 2924 const AutofillProfile& profile = *profiles[i]; |
| 2925 if (!i18ninput::AddressHasCompleteAndVerifiedData(profile) || | 2925 if (!i18ninput::AddressHasCompleteAndVerifiedData(profile) || |
| 2926 !i18ninput::CountryIsFullySupported( | 2926 !i18ninput::CountryIsFullySupported( |
| 2927 UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)))) { | 2927 base::UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)))) { |
| 2928 continue; | 2928 continue; |
| 2929 } | 2929 } |
| 2930 | 2930 |
| 2931 // Don't add variants for addresses: name is part of credit card and | 2931 // Don't add variants for addresses: name is part of credit card and |
| 2932 // we'll just ignore email and phone number variants. | 2932 // we'll just ignore email and phone number variants. |
| 2933 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); | 2933 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); |
| 2934 suggested_shipping_.SetEnabled( | 2934 suggested_shipping_.SetEnabled( |
| 2935 profile.guid(), | 2935 profile.guid(), |
| 2936 CanAcceptCountry( | 2936 CanAcceptCountry( |
| 2937 SECTION_SHIPPING, | 2937 SECTION_SHIPPING, |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 return true; | 3163 return true; |
| 3164 } | 3164 } |
| 3165 | 3165 |
| 3166 return false; | 3166 return false; |
| 3167 } | 3167 } |
| 3168 | 3168 |
| 3169 bool AutofillDialogControllerImpl::ShouldSuggestProfile( | 3169 bool AutofillDialogControllerImpl::ShouldSuggestProfile( |
| 3170 DialogSection section, | 3170 DialogSection section, |
| 3171 const AutofillProfile& profile) { | 3171 const AutofillProfile& profile) { |
| 3172 std::string country_code = | 3172 std::string country_code = |
| 3173 UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); | 3173 base::UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); |
| 3174 return country_code.empty() || CanAcceptCountry(section, country_code); | 3174 return country_code.empty() || CanAcceptCountry(section, country_code); |
| 3175 } | 3175 } |
| 3176 | 3176 |
| 3177 SuggestionsMenuModel* AutofillDialogControllerImpl:: | 3177 SuggestionsMenuModel* AutofillDialogControllerImpl:: |
| 3178 SuggestionsMenuModelForSection(DialogSection section) { | 3178 SuggestionsMenuModelForSection(DialogSection section) { |
| 3179 switch (section) { | 3179 switch (section) { |
| 3180 case SECTION_CC: | 3180 case SECTION_CC: |
| 3181 return &suggested_cc_; | 3181 return &suggested_cc_; |
| 3182 case SECTION_BILLING: | 3182 case SECTION_BILLING: |
| 3183 return &suggested_billing_; | 3183 return &suggested_billing_; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3880 view_->UpdateButtonStrip(); | 3880 view_->UpdateButtonStrip(); |
| 3881 } | 3881 } |
| 3882 | 3882 |
| 3883 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3883 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 3884 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3884 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3885 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3885 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3886 signin_helper_->StartWalletCookieValueFetch(); | 3886 signin_helper_->StartWalletCookieValueFetch(); |
| 3887 } | 3887 } |
| 3888 | 3888 |
| 3889 } // namespace autofill | 3889 } // namespace autofill |
| OLD | NEW |