Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2895473005: [Payments] Have expiration date be on the same line in CC editor (Closed)
Patch Set: addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/views/payments/credit_card_editor_view_controller.h" 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h"
13 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 19 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
19 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 20 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
20 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 21 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
21 #include "chrome/browser/ui/views/payments/preselected_combobox_model.h" 22 #include "chrome/browser/ui/views/payments/preselected_combobox_model.h"
22 #include "chrome/browser/ui/views/payments/validating_combobox.h" 23 #include "chrome/browser/ui/views/payments/validating_combobox.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 years.reserve(kNumberOfExpirationYears); 81 years.reserve(kNumberOfExpirationYears);
81 82
82 base::Time::Exploded now_exploded; 83 base::Time::Exploded now_exploded;
83 autofill::AutofillClock::Now().LocalExplode(&now_exploded); 84 autofill::AutofillClock::Now().LocalExplode(&now_exploded);
84 for (int i = 0; i < kNumberOfExpirationYears; i++) { 85 for (int i = 0; i < kNumberOfExpirationYears; i++) {
85 years.push_back(base::UTF8ToUTF16(std::to_string(now_exploded.year + i))); 86 years.push_back(base::UTF8ToUTF16(std::to_string(now_exploded.year + i)));
86 } 87 }
87 return years; 88 return years;
88 } 89 }
89 90
91 bool IsCardExpired(const base::string16& month,
92 base::string16& year,
93 const std::string& app_locale) {
94 autofill::CreditCard card;
95 card.SetExpirationMonthFromString(month, app_locale);
96 card.SetExpirationYearFromString(year);
97 return card.IsExpired(autofill::AutofillClock::Now());
98 }
99
100 // Validates the two comboboxes used for expiration date.
101 class ExpirationDateValidationDelegate : public ValidationDelegate {
102 public:
103 ExpirationDateValidationDelegate(EditorViewController* controller,
104 const std::string& app_locale)
105 : controller_(controller), app_locale_(app_locale) {}
106
107 bool IsValidTextfield(views::Textfield* textfield) override {
108 NOTREACHED();
109 return true;
110 }
111
112 bool IsValidCombobox(views::Combobox* combobox) override {
113 // Get the combined date from the month and year dropdowns.
114 views::View* view_parent = combobox->parent();
115
116 views::Combobox* month_combobox = static_cast<views::Combobox*>(
117 view_parent->GetViewByID(EditorViewController::GetInputFieldViewId(
118 autofill::CREDIT_CARD_EXP_MONTH)));
119 base::string16 month =
120 month_combobox->model()->GetItemAt(month_combobox->selected_index());
121
122 views::Combobox* year_combobox = static_cast<views::Combobox*>(
123 view_parent->GetViewByID(EditorViewController::GetInputFieldViewId(
124 autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)));
125 base::string16 year =
126 year_combobox->model()->GetItemAt(year_combobox->selected_index());
127
128 bool is_expired = IsCardExpired(month, year, app_locale_);
129 month_combobox->SetInvalid(is_expired);
130 year_combobox->SetInvalid(is_expired);
131
132 return !is_expired;
133 }
134
135 bool TextfieldValueChanged(views::Textfield* textfield) override {
136 NOTREACHED();
137 return true;
138 }
139
140 bool ComboboxValueChanged(views::Combobox* combobox) override {
141 bool is_valid = IsValidCombobox(combobox);
142 controller_->DisplayErrorMessageForField(
143 autofill::CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
144 is_valid ? base::string16()
145 : l10n_util::GetStringUTF16(
146 IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED));
147 return is_valid;
148 }
149
150 void ComboboxModelChanged(views::Combobox* combobox) override {}
151
152 private:
153 EditorViewController* controller_;
154 const std::string app_locale_;
155
156 DISALLOW_COPY_AND_ASSIGN(ExpirationDateValidationDelegate);
157 };
158
90 } // namespace 159 } // namespace
91 160
92 CreditCardEditorViewController::CreditCardEditorViewController( 161 CreditCardEditorViewController::CreditCardEditorViewController(
93 PaymentRequestSpec* spec, 162 PaymentRequestSpec* spec,
94 PaymentRequestState* state, 163 PaymentRequestState* state,
95 PaymentRequestDialogView* dialog, 164 PaymentRequestDialogView* dialog,
96 BackNavigationType back_navigation, 165 BackNavigationType back_navigation,
97 int next_ui_tag, 166 int next_ui_tag,
98 base::OnceClosure on_edited, 167 base::OnceClosure on_edited,
99 base::OnceCallback<void(const autofill::CreditCard&)> on_added, 168 base::OnceCallback<void(const autofill::CreditCard&)> on_added,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 card_icon_view->SetImageSize(kCardIconSize); 227 card_icon_view->SetImageSize(kCardIconSize);
159 228
160 icons_row->AddChildView(card_icon_view.release()); 229 icons_row->AddChildView(card_icon_view.release());
161 } 230 }
162 view->AddChildView(icons_row.release()); 231 view->AddChildView(icons_row.release());
163 232
164 return view; 233 return view;
165 } 234 }
166 235
167 std::unique_ptr<views::View> 236 std::unique_ptr<views::View>
237 CreditCardEditorViewController::CreateCustomFieldView(
238 autofill::ServerFieldType type,
239 views::View** focusable_field,
240 bool* valid) {
241 DCHECK_EQ(type, autofill::CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR);
242
243 std::unique_ptr<views::View> view = base::MakeUnique<views::View>();
244 std::unique_ptr<views::GridLayout> combobox_layout =
245 base::MakeUnique<views::GridLayout>(view.get());
246 views::ColumnSet* columns = combobox_layout->AddColumnSet(0);
247 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
248 views::GridLayout::USE_PREF, 0, 0);
249 // Space between the two comboboxes.
250 constexpr int kHorizontalSpacing = 8;
251 columns->AddPaddingColumn(0, kHorizontalSpacing);
252 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
253 views::GridLayout::USE_PREF, 0, 0);
254
255 combobox_layout->StartRow(0, 0);
256 constexpr int kInputFieldHeight = 28;
257 EditorField tmp_month{autofill::CREDIT_CARD_EXP_MONTH, base::string16(),
258 EditorField::LengthHint::HINT_SHORT,
259 /*required=*/true, EditorField::ControlType::COMBOBOX};
260 std::unique_ptr<ValidatingCombobox> month_combobox =
261 CreateComboboxForField(tmp_month);
262 *focusable_field = month_combobox.get();
263 combobox_layout->AddView(month_combobox.release(), 1, 1,
264 views::GridLayout::FILL, views::GridLayout::FILL, 0,
265 kInputFieldHeight);
266
267 EditorField tmp_year{autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, base::string16(),
268 EditorField::LengthHint::HINT_SHORT,
269 /*required=*/true, EditorField::ControlType::COMBOBOX};
270 std::unique_ptr<ValidatingCombobox> year_combobox =
271 CreateComboboxForField(tmp_year);
272 combobox_layout->AddView(year_combobox.release(), 1, 1,
273 views::GridLayout::FILL, views::GridLayout::FILL, 0,
274 kInputFieldHeight);
275
276 view->SetLayoutManager(combobox_layout.release());
277
278 // Set the initial validity of the custom view.
279 base::string16 month =
280 GetInitialValueForType(autofill::CREDIT_CARD_EXP_MONTH);
281 base::string16 year =
282 GetInitialValueForType(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR);
283 *valid = IsCardExpired(month, year, state()->GetApplicationLocale());
284 return view;
285 }
286
287 std::unique_ptr<views::View>
168 CreditCardEditorViewController::CreateExtraViewForField( 288 CreditCardEditorViewController::CreateExtraViewForField(
169 autofill::ServerFieldType type) { 289 autofill::ServerFieldType type) {
170 if (type != kBillingAddressType) 290 if (type != kBillingAddressType)
171 return nullptr; 291 return nullptr;
172 292
173 std::unique_ptr<views::View> button_view = base::MakeUnique<views::View>(); 293 std::unique_ptr<views::View> button_view = base::MakeUnique<views::View>();
174 button_view->SetLayoutManager(new views::FillLayout); 294 button_view->SetLayoutManager(new views::FillLayout);
175 295
176 // The button to add new billing addresses. 296 // The button to add new billing addresses.
177 std::unique_ptr<views::Button> add_button( 297 std::unique_ptr<views::Button> add_button(
178 views::MdTextButton::Create(this, l10n_util::GetStringUTF16(IDS_ADD))); 298 views::MdTextButton::Create(this, l10n_util::GetStringUTF16(IDS_ADD)));
179 add_button->set_id( 299 add_button->set_id(
180 static_cast<int>(DialogViewID::ADD_BILLING_ADDRESS_BUTTON)); 300 static_cast<int>(DialogViewID::ADD_BILLING_ADDRESS_BUTTON));
181 add_button->set_tag(add_billing_address_button_tag_); 301 add_button->set_tag(add_billing_address_button_tag_);
182 button_view->AddChildView(add_button.release()); 302 button_view->AddChildView(add_button.release());
183 return button_view; 303 return button_view;
184 } 304 }
185 305
186 std::vector<EditorField> CreditCardEditorViewController::GetFieldDefinitions() { 306 std::vector<EditorField> CreditCardEditorViewController::GetFieldDefinitions() {
187 return std::vector<EditorField>{ 307 return std::vector<EditorField>{
188 {autofill::CREDIT_CARD_NUMBER, 308 {autofill::CREDIT_CARD_NUMBER,
189 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER), 309 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER),
190 EditorField::LengthHint::HINT_SHORT, /* required= */ true, 310 EditorField::LengthHint::HINT_SHORT, /*required=*/true,
191 EditorField::ControlType::TEXTFIELD_NUMBER}, 311 EditorField::ControlType::TEXTFIELD_NUMBER},
192 {autofill::CREDIT_CARD_NAME_FULL, 312 {autofill::CREDIT_CARD_NAME_FULL,
193 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD), 313 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD),
194 EditorField::LengthHint::HINT_SHORT, /* required= */ true}, 314 EditorField::LengthHint::HINT_SHORT, /*required=*/true},
195 {autofill::CREDIT_CARD_EXP_MONTH, 315 {autofill::CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
196 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_MONTH), 316 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_DATE),
197 EditorField::LengthHint::HINT_SHORT, /* required= */ true, 317 EditorField::LengthHint::HINT_SHORT, /*required=*/true,
198 EditorField::ControlType::COMBOBOX}, 318 EditorField::ControlType::CUSTOMFIELD},
199 {autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR,
200 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_YEAR),
201 EditorField::LengthHint::HINT_SHORT, /* required= */ true,
202 EditorField::ControlType::COMBOBOX},
203 {kBillingAddressType, 319 {kBillingAddressType,
204 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_BILLING_ADDRESS), 320 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_BILLING_ADDRESS),
205 EditorField::LengthHint::HINT_SHORT, /* required= */ true, 321 EditorField::LengthHint::HINT_SHORT, /*required=*/true,
206 EditorField::ControlType::COMBOBOX}}; 322 EditorField::ControlType::COMBOBOX}};
207 } 323 }
208 324
209 base::string16 CreditCardEditorViewController::GetInitialValueForType( 325 base::string16 CreditCardEditorViewController::GetInitialValueForType(
210 autofill::ServerFieldType type) { 326 autofill::ServerFieldType type) {
211 if (!credit_card_to_edit_ || type == kBillingAddressType) 327 if (!credit_card_to_edit_ || type == kBillingAddressType)
212 return base::string16(); 328 return base::string16();
213 329
214 return credit_card_to_edit_->GetInfo(autofill::AutofillType(type), 330 return credit_card_to_edit_->GetInfo(autofill::AutofillType(type),
215 state()->GetApplicationLocale()); 331 state()->GetApplicationLocale());
(...skipping 16 matching lines...) Expand all
232 field.first->text(), locale); 348 field.first->text(), locale);
233 } 349 }
234 for (const auto& field : comboboxes()) { 350 for (const auto& field : comboboxes()) {
235 // ValidatingCombobox* is the key, EditorField is the value. 351 // ValidatingCombobox* is the key, EditorField is the value.
236 ValidatingCombobox* combobox = field.first; 352 ValidatingCombobox* combobox = field.first;
237 if (combobox->invalid()) 353 if (combobox->invalid())
238 return false; 354 return false;
239 355
240 if (field.second.type == kBillingAddressType) { 356 if (field.second.type == kBillingAddressType) {
241 views::Combobox* address_combobox = static_cast<views::Combobox*>( 357 views::Combobox* address_combobox = static_cast<views::Combobox*>(
242 dialog()->GetViewByID(kBillingAddressType)); 358 dialog()->GetViewByID(GetInputFieldViewId(kBillingAddressType)));
243 autofill::AddressComboboxModel* model = 359 autofill::AddressComboboxModel* model =
244 static_cast<autofill::AddressComboboxModel*>( 360 static_cast<autofill::AddressComboboxModel*>(
245 address_combobox->model()); 361 address_combobox->model());
246 362
247 credit_card.set_billing_address_id( 363 credit_card.set_billing_address_id(
248 model->GetItemIdentifierAt(address_combobox->selected_index())); 364 model->GetItemIdentifierAt(address_combobox->selected_index()));
249 } else { 365 } else {
250 credit_card.SetInfo(autofill::AutofillType(field.second.type), 366 credit_card.SetInfo(autofill::AutofillType(field.second.type),
251 combobox->GetTextForRow(combobox->selected_index()), 367 combobox->GetTextForRow(combobox->selected_index()),
252 locale); 368 locale);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 409 }
294 410
295 return true; 411 return true;
296 } 412 }
297 413
298 std::unique_ptr<ValidationDelegate> 414 std::unique_ptr<ValidationDelegate>
299 CreditCardEditorViewController::CreateValidationDelegate( 415 CreditCardEditorViewController::CreateValidationDelegate(
300 const EditorField& field) { 416 const EditorField& field) {
301 // The supported card networks for non-cc-number types are not passed to avoid 417 // The supported card networks for non-cc-number types are not passed to avoid
302 // the data copy in the delegate. 418 // the data copy in the delegate.
419 if (field.type == autofill::CREDIT_CARD_EXP_MONTH ||
420 field.type == autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)
421 return base::MakeUnique<ExpirationDateValidationDelegate>(
422 this, state()->GetApplicationLocale());
303 return base::MakeUnique< 423 return base::MakeUnique<
304 CreditCardEditorViewController::CreditCardValidationDelegate>( 424 CreditCardEditorViewController::CreditCardValidationDelegate>(
305 field, this, 425 field, this,
306 field.type == autofill::CREDIT_CARD_NUMBER 426 field.type == autofill::CREDIT_CARD_NUMBER
307 ? spec()->supported_card_networks() 427 ? spec()->supported_card_networks()
308 : std::vector<std::string>()); 428 : std::vector<std::string>());
309 } 429 }
310 430
311 std::unique_ptr<ui::ComboboxModel> 431 std::unique_ptr<ui::ComboboxModel>
312 CreditCardEditorViewController::GetComboboxModelForType( 432 CreditCardEditorViewController::GetComboboxModelForType(
(...skipping 22 matching lines...) Expand all
335 } 455 }
336 return std::unique_ptr<ui::ComboboxModel>(); 456 return std::unique_ptr<ui::ComboboxModel>();
337 } 457 }
338 458
339 void CreditCardEditorViewController::FillContentView( 459 void CreditCardEditorViewController::FillContentView(
340 views::View* content_view) { 460 views::View* content_view) {
341 EditorViewController::FillContentView(content_view); 461 EditorViewController::FillContentView(content_view);
342 // We need to search from the content view here, since the dialog may not have 462 // We need to search from the content view here, since the dialog may not have
343 // the content view added to it yet. 463 // the content view added to it yet.
344 views::Combobox* combobox = static_cast<views::Combobox*>( 464 views::Combobox* combobox = static_cast<views::Combobox*>(
345 content_view->GetViewByID(kBillingAddressType)); 465 content_view->GetViewByID(GetInputFieldViewId(kBillingAddressType)));
346 // When the combobox has a single item, it's because it has no addresses 466 // When the combobox has a single item, it's because it has no addresses
347 // (otherwise, it would have the select header, and a separator before the 467 // (otherwise, it would have the select header, and a separator before the
348 // first address to choose from). 468 // first address to choose from).
349 DCHECK(combobox); 469 DCHECK(combobox);
350 combobox->SetEnabled(combobox->GetRowCount() > 1); 470 combobox->SetEnabled(combobox->GetRowCount() > 1);
351 } 471 }
352 472
353 base::string16 CreditCardEditorViewController::GetSheetTitle() { 473 base::string16 CreditCardEditorViewController::GetSheetTitle() {
354 if (!credit_card_to_edit_) 474 if (!credit_card_to_edit_)
355 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD); 475 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD);
(...skipping 19 matching lines...) Expand all
375 &CreditCardEditorViewController::AddAndSelectNewBillingAddress, 495 &CreditCardEditorViewController::AddAndSelectNewBillingAddress,
376 base::Unretained(this)), 496 base::Unretained(this)),
377 /*profile=*/nullptr); 497 /*profile=*/nullptr);
378 } else { 498 } else {
379 EditorViewController::ButtonPressed(sender, event); 499 EditorViewController::ButtonPressed(sender, event);
380 } 500 }
381 } 501 }
382 502
383 void CreditCardEditorViewController::AddAndSelectNewBillingAddress( 503 void CreditCardEditorViewController::AddAndSelectNewBillingAddress(
384 const autofill::AutofillProfile& profile) { 504 const autofill::AutofillProfile& profile) {
385 views::Combobox* address_combobox = 505 views::Combobox* address_combobox = static_cast<views::Combobox*>(
386 static_cast<views::Combobox*>(dialog()->GetViewByID(kBillingAddressType)); 506 dialog()->GetViewByID(GetInputFieldViewId(kBillingAddressType)));
387 autofill::AddressComboboxModel* model = 507 autofill::AddressComboboxModel* model =
388 static_cast<autofill::AddressComboboxModel*>(address_combobox->model()); 508 static_cast<autofill::AddressComboboxModel*>(address_combobox->model());
389 int index = model->AddNewProfile(profile); 509 int index = model->AddNewProfile(profile);
390 // SetSelectedIndex doesn't trigger a perform action notification, which is 510 // SetSelectedIndex doesn't trigger a perform action notification, which is
391 // needed to update the valid state. 511 // needed to update the valid state.
392 address_combobox->SetSelectedRow(index); 512 address_combobox->SetSelectedRow(index);
393 // But it needs to be blured at least once. 513 // But it needs to be blured at least once.
394 address_combobox->OnBlur(); 514 address_combobox->OnBlur();
395 } 515 }
396 516
(...skipping 16 matching lines...) Expand all
413 533
414 bool CreditCardEditorViewController::CreditCardValidationDelegate:: 534 bool CreditCardEditorViewController::CreditCardValidationDelegate::
415 IsValidCombobox(views::Combobox* combobox) { 535 IsValidCombobox(views::Combobox* combobox) {
416 return ValidateCombobox(combobox, nullptr); 536 return ValidateCombobox(combobox, nullptr);
417 } 537 }
418 538
419 bool CreditCardEditorViewController::CreditCardValidationDelegate:: 539 bool CreditCardEditorViewController::CreditCardValidationDelegate::
420 TextfieldValueChanged(views::Textfield* textfield) { 540 TextfieldValueChanged(views::Textfield* textfield) {
421 base::string16 error_message; 541 base::string16 error_message;
422 bool is_valid = ValidateValue(textfield->text(), &error_message); 542 bool is_valid = ValidateValue(textfield->text(), &error_message);
423 controller_->DisplayErrorMessageForField(field_, error_message); 543 controller_->DisplayErrorMessageForField(field_.type, error_message);
424 return is_valid; 544 return is_valid;
425 } 545 }
426 546
427 bool CreditCardEditorViewController::CreditCardValidationDelegate:: 547 bool CreditCardEditorViewController::CreditCardValidationDelegate::
428 ComboboxValueChanged(views::Combobox* combobox) { 548 ComboboxValueChanged(views::Combobox* combobox) {
429 base::string16 error_message; 549 base::string16 error_message;
430 bool is_valid = ValidateCombobox(combobox, nullptr); 550 bool is_valid = ValidateCombobox(combobox, nullptr);
431 controller_->DisplayErrorMessageForField(field_, error_message); 551 controller_->DisplayErrorMessageForField(field_.type, error_message);
432 return is_valid; 552 return is_valid;
433 } 553 }
434 554
435 bool CreditCardEditorViewController::CreditCardValidationDelegate:: 555 bool CreditCardEditorViewController::CreditCardValidationDelegate::
436 ValidateValue(const base::string16& value, base::string16* error_message) { 556 ValidateValue(const base::string16& value, base::string16* error_message) {
437 if (!value.empty()) { 557 if (!value.empty()) {
438 base::string16 local_error_message; 558 base::string16 local_error_message;
439 bool is_valid = 559 bool is_valid =
440 field_.type == autofill::CREDIT_CARD_NUMBER 560 field_.type == autofill::CREDIT_CARD_NUMBER
441 ? autofill::IsValidCreditCardNumberForBasicCardNetworks( 561 ? autofill::IsValidCreditCardNumberForBasicCardNetworks(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()), 595 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()),
476 error_message); 596 error_message);
477 } 597 }
478 598
479 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { 599 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) {
480 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; 600 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET;
481 return true; 601 return true;
482 } 602 }
483 603
484 } // namespace payments 604 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698