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

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

Issue 2694693003: [Payments] Add support for required fields in editor validation (Closed)
Patch Set: 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
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_EDITOR_VIEW_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 namespace payments { 26 namespace payments {
27 27
28 class PaymentRequest; 28 class PaymentRequest;
29 class PaymentRequestDialogView; 29 class PaymentRequestDialogView;
30 30
31 // Field definition for an editor field, used to build the UI. 31 // Field definition for an editor field, used to build the UI.
32 struct EditorField { 32 struct EditorField {
33 enum class LengthHint : int { HINT_LONG, HINT_SHORT }; 33 enum class LengthHint : int { HINT_LONG, HINT_SHORT };
34 34
35 EditorField(autofill::ServerFieldType type, 35 EditorField(autofill::ServerFieldType type,
36 const base::string16& label, 36 const base::string16& label,
anthonyvd 2017/02/13 15:53:53 Can you add a comment about the parameters? label/
Mathieu 2017/02/13 15:58:15 Done.
37 LengthHint length_hint) 37 LengthHint length_hint,
38 : type(type), label(label), length_hint(length_hint) {} 38 bool required)
39 : type(type),
40 label(label),
41 length_hint(length_hint),
42 required(required) {}
39 43
40 const autofill::ServerFieldType type; 44 const autofill::ServerFieldType type;
41 const base::string16 label; 45 const base::string16 label;
42 LengthHint length_hint; 46 LengthHint length_hint;
47 bool required;
43 }; 48 };
44 49
45 // The PaymentRequestSheetController subtype for the editor screens of the 50 // The PaymentRequestSheetController subtype for the editor screens of the
46 // Payment Request flow. 51 // Payment Request flow.
47 class EditorViewController : public PaymentRequestSheetController, 52 class EditorViewController : public PaymentRequestSheetController,
48 public views::TextfieldController { 53 public views::TextfieldController {
49 public: 54 public:
50 using TextFieldsMap = 55 using TextFieldsMap =
51 std::unordered_map<ValidatingTextfield*, const EditorField>; 56 std::unordered_map<ValidatingTextfield*, const EditorField>;
52 57
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // parent view, this only keeps a reference that is good as long as the 96 // parent view, this only keeps a reference that is good as long as the
92 // textfield is visible. 97 // textfield is visible.
93 TextFieldsMap text_fields_; 98 TextFieldsMap text_fields_;
94 99
95 DISALLOW_COPY_AND_ASSIGN(EditorViewController); 100 DISALLOW_COPY_AND_ASSIGN(EditorViewController);
96 }; 101 };
97 102
98 } // namespace payments 103 } // namespace payments
99 104
100 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ 105 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698