| Index: chrome/browser/ui/views/payments/validating_combobox.cc
|
| diff --git a/chrome/browser/ui/views/payments/validating_textfield.cc b/chrome/browser/ui/views/payments/validating_combobox.cc
|
| similarity index 50%
|
| copy from chrome/browser/ui/views/payments/validating_textfield.cc
|
| copy to chrome/browser/ui/views/payments/validating_combobox.cc
|
| index 96361cc1d2c84df8b7b6ac44dfbeca4bafd2d44f..3c14de4592bd6708a37044bc6a67dea691f8d98a 100644
|
| --- a/chrome/browser/ui/views/payments/validating_textfield.cc
|
| +++ b/chrome/browser/ui/views/payments/validating_combobox.cc
|
| @@ -2,20 +2,21 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/ui/views/payments/validating_textfield.h"
|
| +#include "chrome/browser/ui/views/payments/validating_combobox.h"
|
|
|
| #include <utility>
|
|
|
| namespace payments {
|
|
|
| -ValidatingTextfield::ValidatingTextfield(
|
| - std::unique_ptr<ValidatingTextfield::Delegate> delegate)
|
| - : Textfield(), delegate_(std::move(delegate)) {}
|
| +ValidatingCombobox::ValidatingCombobox(
|
| + std::unique_ptr<ui::ComboboxModel> model,
|
| + std::unique_ptr<ValidationDelegate> delegate)
|
| + : Combobox(std::move(model)), delegate_(std::move(delegate)) {}
|
|
|
| -ValidatingTextfield::~ValidatingTextfield() {}
|
| +ValidatingCombobox::~ValidatingCombobox() {}
|
|
|
| -void ValidatingTextfield::OnBlur() {
|
| - Textfield::OnBlur();
|
| +void ValidatingCombobox::OnBlur() {
|
| + Combobox::OnBlur();
|
|
|
| // The first validation should be on a blur. The subsequent validations will
|
| // occur when the content changes.
|
| @@ -25,7 +26,7 @@ void ValidatingTextfield::OnBlur() {
|
| }
|
| }
|
|
|
| -void ValidatingTextfield::OnContentsChanged() {
|
| +void ValidatingCombobox::OnContentsChanged() {
|
| // Validation on every keystroke only happens if the field has been validated
|
| // before as part of a blur.
|
| if (!was_validated_)
|
| @@ -34,9 +35,9 @@ void ValidatingTextfield::OnContentsChanged() {
|
| Validate();
|
| }
|
|
|
| -void ValidatingTextfield::Validate() {
|
| - // ValidateTextfield may have side-effects, such as displaying errors.
|
| - SetInvalid(!delegate_->ValidateTextfield(this));
|
| +void ValidatingCombobox::Validate() {
|
| + // ValidateCombobox may have side-effects, such as displaying errors.
|
| + SetInvalid(!delegate_->ValidateCombobox(this));
|
| }
|
|
|
| } // namespace payments
|
|
|