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_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 <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 | 107 |
108 // Returns the View ID that can be used to lookup the input field for |type|. | 108 // Returns the View ID that can be used to lookup the input field for |type|. |
109 static int GetInputFieldViewId(autofill::ServerFieldType type); | 109 static int GetInputFieldViewId(autofill::ServerFieldType type); |
110 | 110 |
111 protected: | 111 protected: |
112 // Create a header view to be inserted before all fields. | 112 // Create a header view to be inserted before all fields. |
113 virtual std::unique_ptr<views::View> CreateHeaderView(); | 113 virtual std::unique_ptr<views::View> CreateHeaderView(); |
114 // |focusable_field| is to be set with a pointer to the view that should get | 114 // |focusable_field| is to be set with a pointer to the view that should get |
115 // default focus within the custom view. |valid| should be set to the initial | 115 // default focus within the custom view. |valid| should be set to the initial |
116 // validity state of the custom view. | 116 // validity state of the custom view. |
117 virtual std::unique_ptr<views::View> CreateCustomFieldView( | 117 virtual std::unique_ptr<views::View> CreateCustomFieldView( |
Mathieu
2017/05/29 16:45:36
Can you add a comment here, saying that if a custo
tmartino
2017/05/29 21:06:58
Done
| |
118 autofill::ServerFieldType type, | 118 autofill::ServerFieldType type, |
119 views::View** focusable_field, | 119 views::View** focusable_field, |
120 bool* valid); | 120 bool* valid); |
121 // Create an extra view to go to the right of the field with |type|, which | 121 // Create an extra view to go to the right of the field with |type|, which |
122 // can either be a textfield, combobox, or custom view. | 122 // can either be a textfield, combobox, or custom view. |
123 virtual std::unique_ptr<views::View> CreateExtraViewForField( | 123 virtual std::unique_ptr<views::View> CreateExtraViewForField( |
124 autofill::ServerFieldType type); | 124 autofill::ServerFieldType type); |
125 | 125 |
126 // Returns the field definitions used to build the UI. | 126 // Returns the field definitions used to build the UI. |
127 virtual std::vector<EditorField> GetFieldDefinitions() = 0; | 127 virtual std::vector<EditorField> GetFieldDefinitions() = 0; |
128 virtual base::string16 GetInitialValueForType( | 128 virtual base::string16 GetInitialValueForType( |
129 autofill::ServerFieldType type) = 0; | 129 autofill::ServerFieldType type) = 0; |
130 // Validates the data entered and attempts to save; returns true on success. | 130 // Validates the data entered and attempts to save; returns true on success. |
131 virtual bool ValidateModelAndSave() = 0; | 131 virtual bool ValidateModelAndSave() = 0; |
132 | |
132 // Creates a ValidationDelegate which knows how to validate for a given | 133 // Creates a ValidationDelegate which knows how to validate for a given |
133 // |field| definition. | 134 // |field| definition. |
134 virtual std::unique_ptr<ValidationDelegate> CreateValidationDelegate( | 135 virtual std::unique_ptr<ValidationDelegate> CreateValidationDelegate( |
135 const EditorField& field) = 0; | 136 const EditorField& field) = 0; |
136 virtual std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( | 137 virtual std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( |
137 const autofill::ServerFieldType& type) = 0; | 138 const autofill::ServerFieldType& type) = 0; |
138 | 139 |
140 // Returns true if all fields are valid. Relies on cached validity values, | |
Mathieu
2017/05/29 16:45:36
no cache?
tmartino
2017/05/29 21:06:58
Done
| |
141 // which are computed once for all fields at init-time, and subsequently | |
142 // upon user interactions on a per-field basis. | |
143 bool ValidateModel(); | |
144 | |
139 // PaymentRequestSheetController; | 145 // PaymentRequestSheetController; |
140 std::unique_ptr<views::Button> CreatePrimaryButton() override; | 146 std::unique_ptr<views::Button> CreatePrimaryButton() override; |
141 void FillContentView(views::View* content_view) override; | 147 void FillContentView(views::View* content_view) override; |
142 | 148 |
143 // views::ComboboxListener: | 149 // views::ComboboxListener: |
144 void OnPerformAction(views::Combobox* combobox) override; | 150 void OnPerformAction(views::Combobox* combobox) override; |
145 | 151 |
146 // Update the editor view by removing all it's child views and recreating | 152 // Update the editor view by removing all it's child views and recreating |
147 // the input fields returned by GetFieldDefinitions. Note that | 153 // the input fields returned by GetFieldDefinitions. Note that |
148 // CreateEditorView MUST have been called at least once before calling | 154 // CreateEditorView MUST have been called at least once before calling |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 | 201 |
196 // Identifies where to go back when the editing completes successfully. | 202 // Identifies where to go back when the editing completes successfully. |
197 BackNavigationType back_navigation_type_; | 203 BackNavigationType back_navigation_type_; |
198 | 204 |
199 DISALLOW_COPY_AND_ASSIGN(EditorViewController); | 205 DISALLOW_COPY_AND_ASSIGN(EditorViewController); |
200 }; | 206 }; |
201 | 207 |
202 } // namespace payments | 208 } // namespace payments |
203 | 209 |
204 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ | 210 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ |
OLD | NEW |