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_TEXTFIELD_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_ | |
7 | |
8 #include "ui/views/controls/textfield/textfield.h" | |
9 | |
10 namespace payments { | |
11 | |
12 class ValidatingTextfield : public views::Textfield { | |
13 public: | |
14 class Delegate { | |
15 public: | |
please use gerrit instead
2017/02/08 18:50:55
Need an empty destructor:
"To make sure all imple
Mathieu
2017/02/08 21:21:50
Done.
| |
16 // Only the delegate knows how to validate textfield. | |
17 virtual bool ValidateTextfield(ValidatingTextfield* textfield) = 0; | |
18 }; | |
anthonyvd
2017/02/08 15:28:28
DISALLOW_COPY_AND_ASSIGN
Mathieu
2017/02/08 21:21:51
Done.
| |
19 | |
20 explicit ValidatingTextfield(ValidatingTextfield::Delegate* delegate); | |
21 | |
22 // The first validation will happen on blur. | |
23 void OnBlur() override; | |
anthonyvd
2017/02/08 15:28:28
nit: comment about where the override is from.
Mathieu
2017/02/08 21:21:50
Done.
| |
24 | |
25 // Called when the textfield contents is changed. May do validation. | |
26 void OnContentsChanged(); | |
27 | |
28 private: | |
29 // Will call to the Delegate to validate the contents of the textfield. | |
30 void Validate(); | |
31 | |
32 ValidatingTextfield::Delegate* delegate_; | |
33 bool was_validated_ = false; | |
34 }; | |
anthonyvd
2017/02/08 15:28:28
DISALLOW_COPY_AND_ASSIGN
Mathieu
2017/02/08 21:21:50
Done.
| |
35 | |
36 } // namespace payments | |
37 | |
38 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_ | |
OLD | NEW |