| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |