Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/ui/views/payments/validating_textfield.h

Issue 2673753005: [Payments] Basic validation in the credit card editor. (Closed)
Patch Set: more tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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:
16 // Only the delegate knows how to validate textfield.
17 virtual bool ValidateTextfield(ValidatingTextfield* textfield) = 0;
18 };
19
20 explicit ValidatingTextfield(ValidatingTextfield::Delegate* delegate);
21
22 // The first validation will happen on blur.
23 void OnBlur() override;
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 };
35
36 } // namespace payments
37
38 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_TEXTFIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698