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 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 ScopedViewUpdates updates(view_.get()); | 2389 ScopedViewUpdates updates(view_.get()); |
2390 scoped_ptr<DataModelWrapper> wrapper; | 2390 scoped_ptr<DataModelWrapper> wrapper; |
2391 | 2391 |
2392 if (static_cast<size_t>(identifier) < popup_suggestion_ids_.size()) { | 2392 if (static_cast<size_t>(identifier) < popup_suggestion_ids_.size()) { |
2393 const SuggestionBackendID& sid = popup_suggestion_ids_[identifier]; | 2393 const SuggestionBackendID& sid = popup_suggestion_ids_[identifier]; |
2394 if (IsCreditCardType(popup_input_type)) { | 2394 if (IsCreditCardType(popup_input_type)) { |
2395 wrapper.reset(new AutofillCreditCardWrapper( | 2395 wrapper.reset(new AutofillCreditCardWrapper( |
2396 GetManager()->GetCreditCardByGUID(sid.guid))); | 2396 GetManager()->GetCreditCardByGUID(sid.guid))); |
2397 } else { | 2397 } else { |
2398 wrapper.reset(new AutofillProfileWrapper( | 2398 wrapper.reset(new AutofillProfileWrapper( |
2399 GetManager()->GetProfileByGUID(sid.guid), | 2399 GetManager()->GetProfileByGUID(sid.guid))); |
2400 AutofillType(popup_input_type), | |
2401 sid.variant)); | |
2402 } | 2400 } |
2403 } else { | 2401 } else { |
2404 wrapper.reset(new I18nAddressDataWrapper( | 2402 wrapper.reset(new I18nAddressDataWrapper( |
2405 &i18n_validator_suggestions_[ | 2403 &i18n_validator_suggestions_[ |
2406 identifier - popup_suggestion_ids_.size()])); | 2404 identifier - popup_suggestion_ids_.size()])); |
2407 } | 2405 } |
2408 | 2406 |
2409 // If the user hasn't switched away from the default country and |wrapper|'s | 2407 // If the user hasn't switched away from the default country and |wrapper|'s |
2410 // country differs from the |view_|'s, rebuild inputs and restore user data. | 2408 // country differs from the |view_|'s, rebuild inputs and restore user data. |
2411 const FieldValueMap snapshot = TakeUserInputSnapshot(); | 2409 const FieldValueMap snapshot = TakeUserInputSnapshot(); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 g_browser_process->GetApplicationLocale(), | 3047 g_browser_process->GetApplicationLocale(), |
3050 &labels); | 3048 &labels); |
3051 DCHECK_EQ(labels.size(), profiles.size()); | 3049 DCHECK_EQ(labels.size(), profiles.size()); |
3052 for (size_t i = 0; i < profiles.size(); ++i) { | 3050 for (size_t i = 0; i < profiles.size(); ++i) { |
3053 const AutofillProfile& profile = *profiles[i]; | 3051 const AutofillProfile& profile = *profiles[i]; |
3054 if (!i18ninput::AddressHasCompleteAndVerifiedData( | 3052 if (!i18ninput::AddressHasCompleteAndVerifiedData( |
3055 profile, g_browser_process->GetApplicationLocale())) { | 3053 profile, g_browser_process->GetApplicationLocale())) { |
3056 continue; | 3054 continue; |
3057 } | 3055 } |
3058 | 3056 |
3059 // Don't add variants for addresses: name is part of credit card and | |
3060 // we'll just ignore email and phone number variants. | |
3061 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); | 3057 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); |
3062 suggested_shipping_.SetEnabled( | 3058 suggested_shipping_.SetEnabled( |
3063 profile.guid(), | 3059 profile.guid(), |
3064 CanAcceptCountry( | 3060 CanAcceptCountry( |
3065 SECTION_SHIPPING, | 3061 SECTION_SHIPPING, |
3066 base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)))); | 3062 base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)))); |
3067 if (!profile.GetRawInfo(EMAIL_ADDRESS).empty() && | 3063 if (!profile.GetRawInfo(EMAIL_ADDRESS).empty() && |
3068 !profile.IsPresentButInvalid(EMAIL_ADDRESS)) { | 3064 !profile.IsPresentButInvalid(EMAIL_ADDRESS)) { |
3069 suggested_billing_.AddKeyedItem(profile.guid(), labels[i]); | 3065 suggested_billing_.AddKeyedItem(profile.guid(), labels[i]); |
3070 suggested_billing_.SetEnabled( | 3066 suggested_billing_.SetEnabled( |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4117 view_->UpdateButtonStrip(); | 4113 view_->UpdateButtonStrip(); |
4118 } | 4114 } |
4119 | 4115 |
4120 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4116 void AutofillDialogControllerImpl::FetchWalletCookie() { |
4121 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4117 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
4122 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4118 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
4123 signin_helper_->StartWalletCookieValueFetch(); | 4119 signin_helper_->StartWalletCookieValueFetch(); |
4124 } | 4120 } |
4125 | 4121 |
4126 } // namespace autofill | 4122 } // namespace autofill |
OLD | NEW |