| OLD | NEW |
| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 return ValidateValue(textfield->text(), nullptr); | 473 return ValidateValue(textfield->text(), nullptr); |
| 474 } | 474 } |
| 475 | 475 |
| 476 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: | 476 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: |
| 477 IsValidCombobox(views::Combobox* combobox) { | 477 IsValidCombobox(views::Combobox* combobox) { |
| 478 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()), | 478 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()), |
| 479 nullptr); | 479 nullptr); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: | 482 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: |
| 483 TextfieldValueChanged(views::Textfield* textfield) { | 483 TextfieldValueChanged(views::Textfield* textfield, bool was_blurred) { |
| 484 if (!was_blurred) |
| 485 return true; |
| 486 |
| 484 base::string16 error_message; | 487 base::string16 error_message; |
| 485 bool is_valid = ValidateValue(textfield->text(), &error_message); | 488 bool is_valid = ValidateValue(textfield->text(), &error_message); |
| 486 controller_->DisplayErrorMessageForField(field_.type, error_message); | 489 controller_->DisplayErrorMessageForField(field_.type, error_message); |
| 487 return is_valid; | 490 return is_valid; |
| 488 } | 491 } |
| 489 | 492 |
| 490 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: | 493 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: |
| 491 ComboboxValueChanged(views::Combobox* combobox) { | 494 ComboboxValueChanged(views::Combobox* combobox) { |
| 492 base::string16 error_message; | 495 base::string16 error_message; |
| 493 bool is_valid = ValidateValue( | 496 bool is_valid = ValidateValue( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 519 return true; | 522 return true; |
| 520 } | 523 } |
| 521 if (error_message && field_.required) { | 524 if (error_message && field_.required) { |
| 522 *error_message = l10n_util::GetStringUTF16( | 525 *error_message = l10n_util::GetStringUTF16( |
| 523 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 526 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); |
| 524 } | 527 } |
| 525 return !field_.required; | 528 return !field_.required; |
| 526 } | 529 } |
| 527 | 530 |
| 528 } // namespace payments | 531 } // namespace payments |
| OLD | NEW |