| 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ |
| 7 | 7 |
| 8 namespace views { | 8 namespace views { |
| 9 class Combobox; | 9 class Combobox; |
| 10 class Textfield; | 10 class Textfield; |
| 11 } // namespace views | 11 } // namespace views |
| 12 | 12 |
| 13 namespace payments { | 13 namespace payments { |
| 14 | 14 |
| 15 class ValidationDelegate { | 15 class ValidationDelegate { |
| 16 public: | 16 public: |
| 17 virtual ~ValidationDelegate() {} | 17 virtual ~ValidationDelegate() {} |
| 18 | 18 |
| 19 // Only the delegate knows how to validate the input fields. | 19 // Only the delegate knows how to validate the input fields. |
| 20 virtual bool IsValidTextfield(views::Textfield* textfield) = 0; | 20 virtual bool IsValidTextfield(views::Textfield* textfield) = 0; |
| 21 virtual bool IsValidCombobox(views::Combobox* combobox) = 0; | 21 virtual bool IsValidCombobox(views::Combobox* combobox) = 0; |
| 22 | 22 |
| 23 // Notifications to let delegate react to input field changes and also let | 23 // Notifications to let delegate react to input field changes and also let |
| 24 // caller know if the new values are valid. | 24 // caller know if the new values are valid. |was_blurred| indicates if the |
| 25 virtual bool TextfieldValueChanged(views::Textfield* textfield) = 0; | 25 // field has yet to be blurred once by the user. |
| 26 virtual bool TextfieldValueChanged(views::Textfield* textfield, |
| 27 bool was_blurred) = 0; |
| 26 virtual bool ComboboxValueChanged(views::Combobox* combobox) = 0; | 28 virtual bool ComboboxValueChanged(views::Combobox* combobox) = 0; |
| 27 | 29 |
| 28 // Lets the delegate know that the model of the combobox has changed, e.g., | 30 // Lets the delegate know that the model of the combobox has changed, e.g., |
| 29 // when it gets filled asynchronously as for the state field. | 31 // when it gets filled asynchronously as for the state field. |
| 30 virtual void ComboboxModelChanged(views::Combobox* combobox) = 0; | 32 virtual void ComboboxModelChanged(views::Combobox* combobox) = 0; |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 } // namespace payments | 35 } // namespace payments |
| 34 | 36 |
| 35 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ | 37 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ |
| OLD | NEW |