| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/views/payments/validation_delegate.h" |
| 10 #include "ui/views/controls/combobox/combobox.h" |
| 11 |
| 12 namespace payments { |
| 13 |
| 14 class ValidatingCombobox : public views::Combobox { |
| 15 public: |
| 16 ValidatingCombobox(std::unique_ptr<ui::ComboboxModel> model, |
| 17 std::unique_ptr<ValidationDelegate> delegate); |
| 18 ~ValidatingCombobox() override; |
| 19 |
| 20 // Combobox: |
| 21 // The first validation will happen on blur. |
| 22 void OnBlur() override; |
| 23 |
| 24 // Called when the combobox contents is changed. May do validation. |
| 25 void OnContentsChanged(); |
| 26 |
| 27 private: |
| 28 // Will call to the ValidationDelegate to validate the contents of the |
| 29 // combobox. |
| 30 void Validate(); |
| 31 |
| 32 std::unique_ptr<ValidationDelegate> delegate_; |
| 33 bool was_blurred_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(ValidatingCombobox); |
| 36 }; |
| 37 |
| 38 } // namespace payments |
| 39 |
| 40 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_ |
| OLD | NEW |