| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace views { | 30 namespace views { |
| 31 class GridLayout; | 31 class GridLayout; |
| 32 class Label; | 32 class Label; |
| 33 class Textfield; | 33 class Textfield; |
| 34 class View; | 34 class View; |
| 35 } // namespace views | 35 } // namespace views |
| 36 | 36 |
| 37 namespace payments { | 37 namespace payments { |
| 38 | 38 |
| 39 class PaymentRequest; | 39 class PaymentRequestSpec; |
| 40 class PaymentRequestState; |
| 40 class PaymentRequestDialogView; | 41 class PaymentRequestDialogView; |
| 41 class ValidatingCombobox; | 42 class ValidatingCombobox; |
| 42 class ValidatingTextfield; | 43 class ValidatingTextfield; |
| 43 | 44 |
| 44 // Field definition for an editor field, used to build the UI. | 45 // Field definition for an editor field, used to build the UI. |
| 45 struct EditorField { | 46 struct EditorField { |
| 46 enum class LengthHint : int { HINT_LONG, HINT_SHORT }; | 47 enum class LengthHint : int { HINT_LONG, HINT_SHORT }; |
| 47 enum class ControlType : int { TEXTFIELD, COMBOBOX }; | 48 enum class ControlType : int { TEXTFIELD, COMBOBOX }; |
| 48 | 49 |
| 49 EditorField(autofill::ServerFieldType type, | 50 EditorField(autofill::ServerFieldType type, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 public views::ComboboxListener { | 83 public views::ComboboxListener { |
| 83 public: | 84 public: |
| 84 using TextFieldsMap = | 85 using TextFieldsMap = |
| 85 std::unordered_map<ValidatingTextfield*, const EditorField>; | 86 std::unordered_map<ValidatingTextfield*, const EditorField>; |
| 86 using ComboboxMap = | 87 using ComboboxMap = |
| 87 std::unordered_map<ValidatingCombobox*, const EditorField>; | 88 std::unordered_map<ValidatingCombobox*, const EditorField>; |
| 88 using ErrorLabelMap = | 89 using ErrorLabelMap = |
| 89 std::map<const EditorField, views::Label*, EditorField::Compare>; | 90 std::map<const EditorField, views::Label*, EditorField::Compare>; |
| 90 | 91 |
| 91 // Does not take ownership of the arguments, which should outlive this object. | 92 // Does not take ownership of the arguments, which should outlive this object. |
| 92 EditorViewController(PaymentRequest* request, | 93 EditorViewController(PaymentRequestSpec* spec, |
| 94 PaymentRequestState* state, |
| 93 PaymentRequestDialogView* dialog); | 95 PaymentRequestDialogView* dialog); |
| 94 ~EditorViewController() override; | 96 ~EditorViewController() override; |
| 95 | 97 |
| 96 // PaymentRequestSheetController: | 98 // PaymentRequestSheetController: |
| 97 std::unique_ptr<views::View> CreateView() override; | 99 std::unique_ptr<views::View> CreateView() override; |
| 98 | 100 |
| 99 // Will display |error_message| alongside the input field represented by | 101 // Will display |error_message| alongside the input field represented by |
| 100 // |field|. | 102 // |field|. |
| 101 void DisplayErrorMessageForField(const EditorField& field, | 103 void DisplayErrorMessageForField(const EditorField& field, |
| 102 const base::string16& error_message); | 104 const base::string16& error_message); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 ComboboxMap comboboxes_; | 154 ComboboxMap comboboxes_; |
| 153 // Tracks the relationship between a field and its error label. | 155 // Tracks the relationship between a field and its error label. |
| 154 ErrorLabelMap error_labels_; | 156 ErrorLabelMap error_labels_; |
| 155 | 157 |
| 156 DISALLOW_COPY_AND_ASSIGN(EditorViewController); | 158 DISALLOW_COPY_AND_ASSIGN(EditorViewController); |
| 157 }; | 159 }; |
| 158 | 160 |
| 159 } // namespace payments | 161 } // namespace payments |
| 160 | 162 |
| 161 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ | 163 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_EDITOR_VIEW_CONTROLLER_H_ |
| OLD | NEW |