| 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/editor_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/editor_view_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 std::unique_ptr<views::View> EditorViewController::CreateEditorView() { | 144 std::unique_ptr<views::View> EditorViewController::CreateEditorView() { |
| 145 std::unique_ptr<views::View> editor_view = base::MakeUnique<views::View>(); | 145 std::unique_ptr<views::View> editor_view = base::MakeUnique<views::View>(); |
| 146 text_fields_.clear(); | 146 text_fields_.clear(); |
| 147 comboboxes_.clear(); | 147 comboboxes_.clear(); |
| 148 | 148 |
| 149 std::unique_ptr<views::GridLayout> editor_layout = | 149 std::unique_ptr<views::GridLayout> editor_layout = |
| 150 base::MakeUnique<views::GridLayout>(editor_view.get()); | 150 base::MakeUnique<views::GridLayout>(editor_view.get()); |
| 151 | 151 |
| 152 // The editor grid layout is padded vertically from the top and bottom, and | 152 // The editor view is padded vertically from the top and bottom, and |
| 153 // horizontally inset like other content views. The top padding needs to be | 153 // horizontally padded like other content views. The top padding needs to be |
| 154 // added to the top padding of the first row. | 154 // added to the top padding of the first row. |
| 155 constexpr int kEditorVerticalInset = 16; | 155 constexpr int kEditorVerticalInset = 16; |
| 156 editor_layout->SetInsets( | 156 editor_view->SetBorder(views::CreateEmptyBorder( |
| 157 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets, | 157 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets, |
| 158 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets); | 158 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets)); |
| 159 | 159 |
| 160 views::ColumnSet* columns = editor_layout->AddColumnSet(0); | 160 views::ColumnSet* columns = editor_layout->AddColumnSet(0); |
| 161 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 161 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| 162 views::GridLayout::USE_PREF, 0, 0); | 162 views::GridLayout::USE_PREF, 0, 0); |
| 163 | 163 |
| 164 // This is the horizontal padding between the label and the input field. | 164 // This is the horizontal padding between the label and the input field. |
| 165 constexpr int kLabelInputFieldHorizontalPadding = 16; | 165 constexpr int kLabelInputFieldHorizontalPadding = 16; |
| 166 columns->AddPaddingColumn(0, kLabelInputFieldHorizontalPadding); | 166 columns->AddPaddingColumn(0, kLabelInputFieldHorizontalPadding); |
| 167 | 167 |
| 168 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 168 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 error_label->SetFontList( | 242 error_label->SetFontList( |
| 243 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); | 243 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); |
| 244 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( | 244 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( |
| 245 ui::NativeTheme::kColorId_AlertSeverityHigh)); | 245 ui::NativeTheme::kColorId_AlertSeverityHigh)); |
| 246 error_labels_[field] = error_label.get(); | 246 error_labels_[field] = error_label.get(); |
| 247 | 247 |
| 248 layout->AddView(error_label.release()); | 248 layout->AddView(error_label.release()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace payments | 251 } // namespace payments |
| OLD | NEW |