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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 field.Type().GetStorableType()))); | 194 field.Type().GetStorableType()))); |
195 } | 195 } |
196 | 196 |
197 // Initializes |form_group| from user-entered data. | 197 // Initializes |form_group| from user-entered data. |
198 void FillFormGroupFromOutputs(const FieldValueMap& detail_outputs, | 198 void FillFormGroupFromOutputs(const FieldValueMap& detail_outputs, |
199 FormGroup* form_group) { | 199 FormGroup* form_group) { |
200 for (FieldValueMap::const_iterator iter = detail_outputs.begin(); | 200 for (FieldValueMap::const_iterator iter = detail_outputs.begin(); |
201 iter != detail_outputs.end(); ++iter) { | 201 iter != detail_outputs.end(); ++iter) { |
202 ServerFieldType type = iter->first; | 202 ServerFieldType type = iter->first; |
203 if (!iter->second.empty()) { | 203 if (!iter->second.empty()) { |
204 if (type == ADDRESS_HOME_COUNTRY || type == ADDRESS_BILLING_COUNTRY) { | 204 form_group->SetInfo(AutofillType(type), |
205 form_group->SetInfo(AutofillType(type), | 205 iter->second, |
206 iter->second, | 206 g_browser_process->GetApplicationLocale()); |
Ilya Sherman
2014/06/27 06:25:08
Note that SetInfo() can override user-specified fo
Evan Stade
2014/06/28 01:01:35
When is SetInfo meant to be called? Isn't it for d
Ilya Sherman
2014/07/01 02:55:17
SetInfo() is meant to be called on data that's com
Evan Stade
2014/07/01 23:18:52
I'm actually OK with preserving user formatting (w
Ilya Sherman
2014/07/02 00:02:15
There are plenty of forms out there that impose th
Evan Stade
2014/07/07 16:20:52
I see. And instead we impose the formatting that C
Ilya Sherman
2014/07/08 00:35:09
Well, the most common case in the US is that the p
| |
207 g_browser_process->GetApplicationLocale()); | |
208 } else { | |
209 form_group->SetRawInfo( | |
210 AutofillType(type).GetStorableType(), iter->second); | |
211 } | |
212 } | 207 } |
213 } | 208 } |
214 } | 209 } |
215 | 210 |
216 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. | 211 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. |
217 // These outparams are required because |card|/|profile| accept different types | 212 // These outparams are required because |card|/|profile| accept different types |
218 // of raw info, and CreditCard doesn't save CVCs. | 213 // of raw info, and CreditCard doesn't save CVCs. |
219 void GetBillingInfoFromOutputs(const FieldValueMap& output, | 214 void GetBillingInfoFromOutputs(const FieldValueMap& output, |
220 CreditCard* card, | 215 CreditCard* card, |
221 base::string16* cvc, | 216 base::string16* cvc, |
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3044 cards[i]->guid(), | 3039 cards[i]->guid(), |
3045 cards[i]->Label(), | 3040 cards[i]->Label(), |
3046 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); | 3041 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); |
3047 suggested_cc_.SetEnabled( | 3042 suggested_cc_.SetEnabled( |
3048 cards[i]->guid(), | 3043 cards[i]->guid(), |
3049 !ShouldDisallowCcType(cards[i]->TypeForDisplay())); | 3044 !ShouldDisallowCcType(cards[i]->TypeForDisplay())); |
3050 } | 3045 } |
3051 | 3046 |
3052 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); | 3047 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); |
3053 std::vector<base::string16> labels; | 3048 std::vector<base::string16> labels; |
3054 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); | 3049 AutofillProfile::CreateDifferentiatingLabels( |
3050 profiles, | |
3051 g_browser_process->GetApplicationLocale(), | |
3052 &labels); | |
3055 DCHECK_EQ(labels.size(), profiles.size()); | 3053 DCHECK_EQ(labels.size(), profiles.size()); |
3056 for (size_t i = 0; i < profiles.size(); ++i) { | 3054 for (size_t i = 0; i < profiles.size(); ++i) { |
3057 const AutofillProfile& profile = *profiles[i]; | 3055 const AutofillProfile& profile = *profiles[i]; |
3058 if (!i18ninput::AddressHasCompleteAndVerifiedData( | 3056 if (!i18ninput::AddressHasCompleteAndVerifiedData( |
3059 profile, g_browser_process->GetApplicationLocale())) { | 3057 profile, g_browser_process->GetApplicationLocale())) { |
3060 continue; | 3058 continue; |
3061 } | 3059 } |
3062 | 3060 |
3063 // Don't add variants for addresses: name is part of credit card and | 3061 // Don't add variants for addresses: name is part of credit card and |
3064 // we'll just ignore email and phone number variants. | 3062 // we'll just ignore email and phone number variants. |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4128 view_->UpdateButtonStrip(); | 4126 view_->UpdateButtonStrip(); |
4129 } | 4127 } |
4130 | 4128 |
4131 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4129 void AutofillDialogControllerImpl::FetchWalletCookie() { |
4132 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4130 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
4133 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4131 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
4134 signin_helper_->StartWalletCookieValueFetch(); | 4132 signin_helper_->StartWalletCookieValueFetch(); |
4135 } | 4133 } |
4136 | 4134 |
4137 } // namespace autofill | 4135 } // namespace autofill |
OLD | NEW |