OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/order_summary_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // The first column has resize_percent = 1 so that it streches all the way | 62 // The first column has resize_percent = 1 so that it streches all the way |
63 // across the row up to the amount label. This way the first label elides as | 63 // across the row up to the amount label. This way the first label elides as |
64 // required. | 64 // required. |
65 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, | 65 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, |
66 views::GridLayout::USE_PREF, 0, 0); | 66 views::GridLayout::USE_PREF, 0, 0); |
67 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0, | 67 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0, |
68 views::GridLayout::FIXED, kAmountSectionWidth, | 68 views::GridLayout::FIXED, kAmountSectionWidth, |
69 kAmountSectionWidth); | 69 kAmountSectionWidth); |
70 | 70 |
71 layout->StartRow(0, 0); | 71 layout->StartRow(0, 0); |
72 std::unique_ptr<views::Label> label_text; | 72 std::unique_ptr<views::Label> label_text = |
73 std::unique_ptr<views::Label> amount_text; | 73 base::MakeUnique<views::Label>(label); |
74 if (emphasize) { | 74 std::unique_ptr<views::Label> amount_text = |
75 label_text = CreateMediumLabel(label); | 75 base::MakeUnique<views::Label>(amount); |
76 amount_text = CreateMediumLabel(amount); | |
77 } else { | |
78 label_text = base::MakeUnique<views::Label>(label); | |
79 amount_text = base::MakeUnique<views::Label>(amount); | |
80 } | |
81 amount_text->set_id(static_cast<int>(amount_label_id)); | 76 amount_text->set_id(static_cast<int>(amount_label_id)); |
82 amount_text->SetMultiLine(true); | 77 amount_text->SetMultiLine(true); |
83 amount_text->SetAllowCharacterBreak(true); | 78 amount_text->SetAllowCharacterBreak(true); |
| 79 if (emphasize) { |
| 80 label_text->SetFontList( |
| 81 label_text->font_list().DeriveWithWeight(gfx::Font::Weight::MEDIUM)); |
| 82 amount_text->SetFontList( |
| 83 amount_text->font_list().DeriveWithWeight(gfx::Font::Weight::MEDIUM)); |
| 84 } |
84 layout->AddView(label_text.release()); | 85 layout->AddView(label_text.release()); |
85 layout->AddView(amount_text.release()); | 86 layout->AddView(amount_text.release()); |
86 | 87 |
87 return row; | 88 return row; |
88 } | 89 } |
89 | 90 |
90 } // namespace | 91 } // namespace |
91 | 92 |
92 OrderSummaryViewController::OrderSummaryViewController( | 93 OrderSummaryViewController::OrderSummaryViewController( |
93 PaymentRequestSpec* spec, | 94 PaymentRequestSpec* spec, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 total_label_value, true, | 175 total_label_value, true, |
175 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) | 176 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) |
176 .release()); | 177 .release()); |
177 } | 178 } |
178 | 179 |
179 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { | 180 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { |
180 pay_button_->SetEnabled(enabled); | 181 pay_button_->SetEnabled(enabled); |
181 } | 182 } |
182 | 183 |
183 } // namespace payments | 184 } // namespace payments |
OLD | NEW |