| 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 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 13 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 15 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 15 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 16 #include "chrome/browser/ui/views/payments/validating_combobox.h" | 17 #include "chrome/browser/ui/views/payments/validating_combobox.h" |
| 17 #include "chrome/browser/ui/views/payments/validating_textfield.h" | 18 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/gfx/geometry/insets.h" | 22 #include "ui/gfx/geometry/insets.h" |
| 22 #include "ui/native_theme/native_theme.h" | 23 #include "ui/native_theme/native_theme.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); | 52 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); |
| 52 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 53 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
| 53 layout->set_cross_axis_alignment( | 54 layout->set_cross_axis_alignment( |
| 54 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | 55 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); |
| 55 // This is the space between the input field and the error label. | 56 // This is the space between the input field and the error label. |
| 56 constexpr int kErrorLabelTopPadding = 6; | 57 constexpr int kErrorLabelTopPadding = 6; |
| 57 layout->set_inside_border_insets(gfx::Insets(kErrorLabelTopPadding, 0, 0, 0)); | 58 layout->set_inside_border_insets(gfx::Insets(kErrorLabelTopPadding, 0, 0, 0)); |
| 58 view->SetLayoutManager(layout.release()); | 59 view->SetLayoutManager(layout.release()); |
| 59 | 60 |
| 60 std::unique_ptr<views::Label> error_label = | 61 std::unique_ptr<views::Label> error_label = |
| 61 base::MakeUnique<views::Label>(error); | 62 base::MakeUnique<views::Label>(error, CONTEXT_DEPRECATED_SMALL); |
| 62 error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + | 63 error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + |
| 63 field.type); | 64 field.type); |
| 64 error_label->SetFontList( | |
| 65 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); | |
| 66 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( | 65 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( |
| 67 ui::NativeTheme::kColorId_AlertSeverityHigh)); | 66 ui::NativeTheme::kColorId_AlertSeverityHigh)); |
| 68 | 67 |
| 69 view->AddChildView(error_label.release()); | 68 view->AddChildView(error_label.release()); |
| 70 return view; | 69 return view; |
| 71 } | 70 } |
| 72 | 71 |
| 73 } // namespace | 72 } // namespace |
| 74 | 73 |
| 75 EditorViewController::EditorViewController( | 74 EditorViewController::EditorViewController( |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 CreateExtraViewForField(field.type); | 377 CreateExtraViewForField(field.type); |
| 379 if (!extra_view) | 378 if (!extra_view) |
| 380 continue; | 379 continue; |
| 381 widest_column_width = | 380 widest_column_width = |
| 382 std::max(extra_view->GetPreferredSize().width(), widest_column_width); | 381 std::max(extra_view->GetPreferredSize().width(), widest_column_width); |
| 383 } | 382 } |
| 384 return widest_column_width; | 383 return widest_column_width; |
| 385 } | 384 } |
| 386 | 385 |
| 387 } // namespace payments | 386 } // namespace payments |
| OLD | NEW |