| 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/validating_textfield.h" | 5 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 namespace payments { | 9 namespace payments { |
| 10 | 10 |
| 11 ValidatingTextfield::ValidatingTextfield( | 11 ValidatingTextfield::ValidatingTextfield( |
| 12 std::unique_ptr<ValidatingTextfield::Delegate> delegate) | 12 std::unique_ptr<ValidationDelegate> delegate) |
| 13 : Textfield(), delegate_(std::move(delegate)) {} | 13 : Textfield(), delegate_(std::move(delegate)) {} |
| 14 | 14 |
| 15 ValidatingTextfield::~ValidatingTextfield() {} | 15 ValidatingTextfield::~ValidatingTextfield() {} |
| 16 | 16 |
| 17 void ValidatingTextfield::OnBlur() { | 17 void ValidatingTextfield::OnBlur() { |
| 18 Textfield::OnBlur(); | 18 Textfield::OnBlur(); |
| 19 | 19 |
| 20 // The first validation should be on a blur. The subsequent validations will | 20 // The first validation should be on a blur. The subsequent validations will |
| 21 // occur when the content changes. | 21 // occur when the content changes. |
| 22 if (!was_validated_) { | 22 if (!was_validated_) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 Validate(); | 34 Validate(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ValidatingTextfield::Validate() { | 37 void ValidatingTextfield::Validate() { |
| 38 // ValidateTextfield may have side-effects, such as displaying errors. | 38 // ValidateTextfield may have side-effects, such as displaying errors. |
| 39 SetInvalid(!delegate_->ValidateTextfield(this)); | 39 SetInvalid(!delegate_->ValidateTextfield(this)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace payments | 42 } // namespace payments |
| OLD | NEW |