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 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // | Cards Accepted | | 99 // | Cards Accepted | |
100 // | | | 100 // | | |
101 // | | VISA | | MC | | AMEX | | | 101 // | | VISA | | MC | | AMEX | | |
102 // +----------------------------------------------+ | 102 // +----------------------------------------------+ |
103 std::unique_ptr<views::View> | 103 std::unique_ptr<views::View> |
104 CreditCardEditorViewController::CreateHeaderView() { | 104 CreditCardEditorViewController::CreateHeaderView() { |
105 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); | 105 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); |
106 | 106 |
107 // 9dp is required between the first row (label) and second row (icons). | 107 // 9dp is required between the first row (label) and second row (icons). |
108 constexpr int kRowVerticalSpacing = 9; | 108 constexpr int kRowVerticalSpacing = 9; |
| 109 // 6dp is added to the bottom padding, for a total of 12 between the icons and |
| 110 // the first input field. |
| 111 constexpr int kRowBottomPadding = 6; |
109 views::BoxLayout* layout = new views::BoxLayout( | 112 views::BoxLayout* layout = new views::BoxLayout( |
110 views::BoxLayout::kVertical, payments::kPaymentRequestRowHorizontalInsets, | 113 views::BoxLayout::kVertical, payments::kPaymentRequestRowHorizontalInsets, |
111 0, kRowVerticalSpacing); | 114 kRowBottomPadding, kRowVerticalSpacing); |
112 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 115 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
113 layout->set_cross_axis_alignment( | 116 layout->set_cross_axis_alignment( |
114 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 117 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
115 view->SetLayoutManager(layout); | 118 view->SetLayoutManager(layout); |
116 | 119 |
117 // "Cards accepted" label is "disabled" grey. | 120 // "Cards accepted" label is "disabled" grey. |
118 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>( | 121 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>( |
119 l10n_util::GetStringUTF16(IDS_PAYMENTS_ACCEPTED_CARDS_LABEL)); | 122 l10n_util::GetStringUTF16(IDS_PAYMENTS_ACCEPTED_CARDS_LABEL)); |
120 label->SetDisabledColor(label->GetNativeTheme()->GetSystemColor( | 123 label->SetDisabledColor(label->GetNativeTheme()->GetSystemColor( |
121 ui::NativeTheme::kColorId_LabelDisabledColor)); | 124 ui::NativeTheme::kColorId_LabelDisabledColor)); |
(...skipping 23 matching lines...) Expand all Loading... |
145 } | 148 } |
146 view->AddChildView(icons_row.release()); | 149 view->AddChildView(icons_row.release()); |
147 | 150 |
148 return view; | 151 return view; |
149 } | 152 } |
150 | 153 |
151 std::vector<EditorField> CreditCardEditorViewController::GetFieldDefinitions() { | 154 std::vector<EditorField> CreditCardEditorViewController::GetFieldDefinitions() { |
152 return std::vector<EditorField>{ | 155 return std::vector<EditorField>{ |
153 {autofill::CREDIT_CARD_NUMBER, | 156 {autofill::CREDIT_CARD_NUMBER, |
154 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER), | 157 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER), |
155 EditorField::LengthHint::HINT_LONG, /* required= */ true}, | 158 EditorField::LengthHint::HINT_SHORT, /* required= */ true}, |
156 {autofill::CREDIT_CARD_NAME_FULL, | 159 {autofill::CREDIT_CARD_NAME_FULL, |
157 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD), | 160 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD), |
158 EditorField::LengthHint::HINT_LONG, /* required= */ true}, | 161 EditorField::LengthHint::HINT_SHORT, /* required= */ true}, |
159 {autofill::CREDIT_CARD_EXP_MONTH, | 162 {autofill::CREDIT_CARD_EXP_MONTH, |
160 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_MONTH), | 163 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_MONTH), |
161 EditorField::LengthHint::HINT_SHORT, /* required= */ true, | 164 EditorField::LengthHint::HINT_SHORT, /* required= */ true, |
162 EditorField::ControlType::COMBOBOX}, | 165 EditorField::ControlType::COMBOBOX}, |
163 {autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, | 166 {autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, |
164 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_YEAR), | 167 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_YEAR), |
165 EditorField::LengthHint::HINT_SHORT, /* required= */ true, | 168 EditorField::LengthHint::HINT_SHORT, /* required= */ true, |
166 EditorField::ControlType::COMBOBOX}}; | 169 EditorField::ControlType::COMBOBOX}}; |
167 } | 170 } |
168 | 171 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 controller_->DisplayErrorMessageForField(field_, displayed_message); | 330 controller_->DisplayErrorMessageForField(field_, displayed_message); |
328 return is_required_valid; | 331 return is_required_valid; |
329 } | 332 } |
330 | 333 |
331 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { | 334 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { |
332 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; | 335 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; |
333 return true; | 336 return true; |
334 } | 337 } |
335 | 338 |
336 } // namespace payments | 339 } // namespace payments |
OLD | NEW |