| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Update the editor view by removing all it's child views and recreating | 128 // Update the editor view by removing all it's child views and recreating |
| 129 // the input fields returned by GetFieldDefinitions. Note that | 129 // the input fields returned by GetFieldDefinitions. Note that |
| 130 // CreateEditorView MUST have been called at least once before calling | 130 // CreateEditorView MUST have been called at least once before calling |
| 131 // UpdateEditorView. | 131 // UpdateEditorView. |
| 132 virtual void UpdateEditorView(); | 132 virtual void UpdateEditorView(); |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 // PaymentRequestSheetController: | 135 // PaymentRequestSheetController: |
| 136 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 136 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 137 views::View* GetFirstFocusedView() override; |
| 137 | 138 |
| 138 // views::TextfieldController: | 139 // views::TextfieldController: |
| 139 void ContentsChanged(views::Textfield* sender, | 140 void ContentsChanged(views::Textfield* sender, |
| 140 const base::string16& new_contents) override; | 141 const base::string16& new_contents) override; |
| 141 | 142 |
| 142 // Creates the whole editor view to go within the editor dialog. It | 143 // Creates the whole editor view to go within the editor dialog. It |
| 143 // encompasses all the input fields created by CreateInputField(). | 144 // encompasses all the input fields created by CreateInputField(). |
| 144 std::unique_ptr<views::View> CreateEditorView(); | 145 std::unique_ptr<views::View> CreateEditorView(); |
| 145 | 146 |
| 146 // Adds some views to |layout|, to represent an input field and its labels. | 147 // Adds some views to |layout|, to represent an input field and its labels. |
| 147 // |field| is the field definition, which contains the label and the hint | 148 // |field| is the field definition, which contains the label and the hint |
| 148 // about the length of the input field. A placeholder error label is also | 149 // about the length of the input field. A placeholder error label is also |
| 149 // added (see implementation). | 150 // added (see implementation). |
| 150 void CreateInputField(views::GridLayout* layout, const EditorField& field); | 151 void CreateInputField(views::GridLayout* layout, const EditorField& field); |
| 151 | 152 |
| 152 // Used to remember the association between the input field UI element and the | 153 // Used to remember the association between the input field UI element and the |
| 153 // original field definition. The ValidatingTextfield* and ValidatingCombobox* | 154 // original field definition. The ValidatingTextfield* and ValidatingCombobox* |
| 154 // are owned by their parent view, this only keeps a reference that is good as | 155 // are owned by their parent view, this only keeps a reference that is good as |
| 155 // long as the input field is visible. | 156 // long as the input field is visible. |
| 156 TextFieldsMap text_fields_; | 157 TextFieldsMap text_fields_; |
| 157 ComboboxMap comboboxes_; | 158 ComboboxMap comboboxes_; |
| 158 // Tracks the relationship between a field and its error label. | 159 // Tracks the relationship between a field and its error label. |
| 159 ErrorLabelMap error_labels_; | 160 ErrorLabelMap error_labels_; |
| 160 | 161 |
| 162 // The first label in the editor, used to set the initial focus. |
| 163 views::View* first_field_view_; |
| 164 |
| 161 DISALLOW_COPY_AND_ASSIGN(EditorViewController); | 165 DISALLOW_COPY_AND_ASSIGN(EditorViewController); |
| 162 }; | 166 }; |
| 163 | 167 |
| 164 } // namespace payments | 168 } // namespace payments |
| 165 | 169 |
| 166 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ | 170 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ |
| OLD | NEW |