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

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

Issue 2896263002: [Payments] Changes to validation in the Credit Card editor (Closed)
Patch Set: Initial 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/shipping_address_editor_view_controll er.h" 5 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return ValidateValue(textfield->text(), nullptr); 450 return ValidateValue(textfield->text(), nullptr);
451 } 451 }
452 452
453 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: 453 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
454 IsValidCombobox(views::Combobox* combobox) { 454 IsValidCombobox(views::Combobox* combobox) {
455 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()), 455 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()),
456 nullptr); 456 nullptr);
457 } 457 }
458 458
459 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: 459 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
460 TextfieldValueChanged(views::Textfield* textfield) { 460 TextfieldValueChanged(views::Textfield* textfield, bool was_blurred) {
461 if (!was_blurred)
462 return true;
463
461 base::string16 error_message; 464 base::string16 error_message;
462 bool is_valid = ValidateValue(textfield->text(), &error_message); 465 bool is_valid = ValidateValue(textfield->text(), &error_message);
463 controller_->DisplayErrorMessageForField(field_.type, error_message); 466 controller_->DisplayErrorMessageForField(field_.type, error_message);
464 return is_valid; 467 return is_valid;
465 } 468 }
466 469
467 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: 470 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
468 ComboboxValueChanged(views::Combobox* combobox) { 471 ComboboxValueChanged(views::Combobox* combobox) {
469 base::string16 error_message; 472 base::string16 error_message;
470 bool is_valid = ValidateValue( 473 bool is_valid = ValidateValue(
(...skipping 25 matching lines...) Expand all
496 return true; 499 return true;
497 } 500 }
498 if (error_message && field_.required) { 501 if (error_message && field_.required) {
499 *error_message = l10n_util::GetStringUTF16( 502 *error_message = l10n_util::GetStringUTF16(
500 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 503 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
501 } 504 }
502 return !field_.required; 505 return !field_.required;
503 } 506 }
504 507
505 } // namespace payments 508 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698