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

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

Issue 2896263002: [Payments] Changes to validation in the Credit Card editor (Closed)
Patch Set: rebase Created 3 years, 7 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
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 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 9
10 namespace views { 10 namespace views {
11 class Combobox; 11 class Combobox;
12 class Textfield; 12 class Textfield;
13 } // namespace views 13 } // namespace views
14 14
15 namespace payments { 15 namespace payments {
16 16
17 // Handles text field validation and formatting. 17 // Handles text field validation and formatting.
18 class ValidationDelegate { 18 class ValidationDelegate {
19 public: 19 public:
20 virtual ~ValidationDelegate(); 20 virtual ~ValidationDelegate();
21 21
22 virtual bool ShouldFormat(); 22 virtual bool ShouldFormat();
23 virtual base::string16 Format(const base::string16& text); 23 virtual base::string16 Format(const base::string16& text);
24 24
25 // Only the delegate knows how to validate the input fields. 25 // Only the delegate knows how to validate the input fields.
26 virtual bool IsValidTextfield(views::Textfield* textfield) = 0; 26 virtual bool IsValidTextfield(views::Textfield* textfield) = 0;
27 virtual bool IsValidCombobox(views::Combobox* combobox) = 0; 27 virtual bool IsValidCombobox(views::Combobox* combobox) = 0;
28 28
29 // Notifications to let delegate react to input field changes and also let 29 // Notifications to let delegate react to input field changes and also let
30 // caller know if the new values are valid. 30 // caller know if the new values are valid. |was_blurred| indicates if the
31 virtual bool TextfieldValueChanged(views::Textfield* textfield) = 0; 31 // field has yet to be blurred once by the user.
32 virtual bool TextfieldValueChanged(views::Textfield* textfield,
33 bool was_blurred) = 0;
32 virtual bool ComboboxValueChanged(views::Combobox* combobox) = 0; 34 virtual bool ComboboxValueChanged(views::Combobox* combobox) = 0;
33 35
34 // Lets the delegate know that the model of the combobox has changed, e.g., 36 // Lets the delegate know that the model of the combobox has changed, e.g.,
35 // when it gets filled asynchronously as for the state field. 37 // when it gets filled asynchronously as for the state field.
36 virtual void ComboboxModelChanged(views::Combobox* combobox) = 0; 38 virtual void ComboboxModelChanged(views::Combobox* combobox) = 0;
37 }; 39 };
38 40
39 } // namespace payments 41 } // namespace payments
40 42
41 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_ 43 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698