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