| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 std::unique_ptr<views::View> EditorViewController::CreateEditorView() { | 151 std::unique_ptr<views::View> EditorViewController::CreateEditorView() { |
| 152 std::unique_ptr<views::View> editor_view = base::MakeUnique<views::View>(); | 152 std::unique_ptr<views::View> editor_view = base::MakeUnique<views::View>(); |
| 153 text_fields_.clear(); | 153 text_fields_.clear(); |
| 154 comboboxes_.clear(); | 154 comboboxes_.clear(); |
| 155 | 155 |
| 156 std::unique_ptr<views::GridLayout> editor_layout = | 156 std::unique_ptr<views::GridLayout> editor_layout = |
| 157 base::MakeUnique<views::GridLayout>(editor_view.get()); | 157 base::MakeUnique<views::GridLayout>(editor_view.get()); |
| 158 | 158 |
| 159 // The editor grid layout is padded vertically from the top and bottom, and | 159 // The editor view is padded vertically from the top and bottom, and |
| 160 // horizontally inset like other content views. The top padding needs to be | 160 // horizontally padded like other content views. The top padding needs to be |
| 161 // added to the top padding of the first row. | 161 // added to the top padding of the first row. |
| 162 constexpr int kEditorVerticalInset = 16; | 162 constexpr int kEditorVerticalInset = 16; |
| 163 editor_layout->SetInsets( | 163 editor_view->SetBorder(views::CreateEmptyBorder( |
| 164 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets, | 164 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets, |
| 165 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets); | 165 kEditorVerticalInset, payments::kPaymentRequestRowHorizontalInsets)); |
| 166 | 166 |
| 167 views::ColumnSet* columns = editor_layout->AddColumnSet(0); | 167 views::ColumnSet* columns = editor_layout->AddColumnSet(0); |
| 168 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 168 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| 169 views::GridLayout::USE_PREF, 0, 0); | 169 views::GridLayout::USE_PREF, 0, 0); |
| 170 | 170 |
| 171 // This is the horizontal padding between the label and the input field. | 171 // This is the horizontal padding between the label and the input field. |
| 172 constexpr int kLabelInputFieldHorizontalPadding = 16; | 172 constexpr int kLabelInputFieldHorizontalPadding = 16; |
| 173 columns->AddPaddingColumn(0, kLabelInputFieldHorizontalPadding); | 173 columns->AddPaddingColumn(0, kLabelInputFieldHorizontalPadding); |
| 174 | 174 |
| 175 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 175 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 error_label->SetFontList( | 259 error_label->SetFontList( |
| 260 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); | 260 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); |
| 261 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( | 261 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( |
| 262 ui::NativeTheme::kColorId_AlertSeverityHigh)); | 262 ui::NativeTheme::kColorId_AlertSeverityHigh)); |
| 263 error_labels_[field] = error_label.get(); | 263 error_labels_[field] = error_label.get(); |
| 264 | 264 |
| 265 layout->AddView(error_label.release()); | 265 layout->AddView(error_label.release()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace payments | 268 } // namespace payments |
| OLD | NEW |