| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 647 |
| 648 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { | 648 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { |
| 649 if (popup_controller_) | 649 if (popup_controller_) |
| 650 popup_controller_->Hide(); | 650 popup_controller_->Hide(); |
| 651 | 651 |
| 652 GetMetricLogger().LogDialogInitialUserState(initial_user_state_); | 652 GetMetricLogger().LogDialogInitialUserState(initial_user_state_); |
| 653 } | 653 } |
| 654 | 654 |
| 655 bool CountryFilter(const std::set<base::string16>& possible_values, | 655 bool CountryFilter(const std::set<base::string16>& possible_values, |
| 656 const std::string& country_code) { | 656 const std::string& country_code) { |
| 657 if (!i18ninput::CountryIsFullySupported(country_code)) | |
| 658 return false; | |
| 659 | |
| 660 if (!possible_values.empty() && | 657 if (!possible_values.empty() && |
| 661 !possible_values.count(base::ASCIIToUTF16(country_code))) { | 658 !possible_values.count(base::ASCIIToUTF16(country_code))) { |
| 662 return false; | 659 return false; |
| 663 } | 660 } |
| 664 | 661 |
| 665 return true; | 662 return true; |
| 666 } | 663 } |
| 667 | 664 |
| 668 // static | 665 // static |
| 669 base::WeakPtr<AutofillDialogControllerImpl> | 666 base::WeakPtr<AutofillDialogControllerImpl> |
| (...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3024 !ShouldDisallowCcType(cards[i]->TypeForDisplay())); | 3021 !ShouldDisallowCcType(cards[i]->TypeForDisplay())); |
| 3025 } | 3022 } |
| 3026 | 3023 |
| 3027 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); | 3024 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); |
| 3028 std::vector<base::string16> labels; | 3025 std::vector<base::string16> labels; |
| 3029 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); | 3026 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); |
| 3030 DCHECK_EQ(labels.size(), profiles.size()); | 3027 DCHECK_EQ(labels.size(), profiles.size()); |
| 3031 for (size_t i = 0; i < profiles.size(); ++i) { | 3028 for (size_t i = 0; i < profiles.size(); ++i) { |
| 3032 const AutofillProfile& profile = *profiles[i]; | 3029 const AutofillProfile& profile = *profiles[i]; |
| 3033 if (!i18ninput::AddressHasCompleteAndVerifiedData( | 3030 if (!i18ninput::AddressHasCompleteAndVerifiedData( |
| 3034 profile, g_browser_process->GetApplicationLocale()) || | 3031 profile, g_browser_process->GetApplicationLocale())) { |
| 3035 !i18ninput::CountryIsFullySupported( | |
| 3036 base::UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)))) { | |
| 3037 continue; | 3032 continue; |
| 3038 } | 3033 } |
| 3039 | 3034 |
| 3040 // Don't add variants for addresses: name is part of credit card and | 3035 // Don't add variants for addresses: name is part of credit card and |
| 3041 // we'll just ignore email and phone number variants. | 3036 // we'll just ignore email and phone number variants. |
| 3042 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); | 3037 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); |
| 3043 suggested_shipping_.SetEnabled( | 3038 suggested_shipping_.SetEnabled( |
| 3044 profile.guid(), | 3039 profile.guid(), |
| 3045 CanAcceptCountry( | 3040 CanAcceptCountry( |
| 3046 SECTION_SHIPPING, | 3041 SECTION_SHIPPING, |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4095 view_->UpdateButtonStrip(); | 4090 view_->UpdateButtonStrip(); |
| 4096 } | 4091 } |
| 4097 | 4092 |
| 4098 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4093 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 4099 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4094 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 4100 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4095 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 4101 signin_helper_->StartWalletCookieValueFetch(); | 4096 signin_helper_->StartWalletCookieValueFetch(); |
| 4102 } | 4097 } |
| 4103 | 4098 |
| 4104 } // namespace autofill | 4099 } // namespace autofill |
| OLD | NEW |