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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | |
15 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
16 #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" |
17 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
18 #include "chrome/browser/ui/views/payments/validating_combobox.h" | 17 #include "chrome/browser/ui/views/payments/validating_combobox.h" |
19 #include "chrome/browser/ui/views/payments/validating_textfield.h" | 18 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
20 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
21 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
22 #include "ui/base/ime/text_input_type.h" | 21 #include "ui/base/ime/text_input_type.h" |
23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/gfx/geometry/insets.h" | 23 #include "ui/gfx/geometry/insets.h" |
(...skipping 30 matching lines...) Expand all Loading... |
55 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); | 54 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); |
56 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 55 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
57 layout->set_cross_axis_alignment( | 56 layout->set_cross_axis_alignment( |
58 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | 57 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); |
59 // This is the space between the input field and the error label. | 58 // This is the space between the input field and the error label. |
60 constexpr int kErrorLabelTopPadding = 6; | 59 constexpr int kErrorLabelTopPadding = 6; |
61 layout->set_inside_border_insets(gfx::Insets(kErrorLabelTopPadding, 0, 0, 0)); | 60 layout->set_inside_border_insets(gfx::Insets(kErrorLabelTopPadding, 0, 0, 0)); |
62 view->SetLayoutManager(layout.release()); | 61 view->SetLayoutManager(layout.release()); |
63 | 62 |
64 std::unique_ptr<views::Label> error_label = | 63 std::unique_ptr<views::Label> error_label = |
65 base::MakeUnique<views::Label>(error, CONTEXT_DEPRECATED_SMALL); | 64 base::MakeUnique<views::Label>(error); |
66 error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + | 65 error_label->set_id(static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + |
67 type); | 66 type); |
| 67 error_label->SetFontList( |
| 68 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); |
68 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( | 69 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( |
69 ui::NativeTheme::kColorId_AlertSeverityHigh)); | 70 ui::NativeTheme::kColorId_AlertSeverityHigh)); |
70 | 71 |
71 view->AddChildView(error_label.release()); | 72 view->AddChildView(error_label.release()); |
72 return view; | 73 return view; |
73 } | 74 } |
74 | 75 |
75 } // namespace | 76 } // namespace |
76 | 77 |
77 EditorViewController::EditorViewController( | 78 EditorViewController::EditorViewController( |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 CreateExtraViewForField(field.type); | 410 CreateExtraViewForField(field.type); |
410 if (!extra_view) | 411 if (!extra_view) |
411 continue; | 412 continue; |
412 widest_column_width = | 413 widest_column_width = |
413 std::max(extra_view->GetPreferredSize().width(), widest_column_width); | 414 std::max(extra_view->GetPreferredSize().width(), widest_column_width); |
414 } | 415 } |
415 return widest_column_width; | 416 return widest_column_width; |
416 } | 417 } |
417 | 418 |
418 } // namespace payments | 419 } // namespace payments |
OLD | NEW |