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 base::MakeUnique<views::Label>(label); | 73 std::unique_ptr<views::Label> amount_text; |
74 std::unique_ptr<views::Label> amount_text = | 74 if (emphasize) { |
75 base::MakeUnique<views::Label>(amount); | 75 label_text = CreateMediumLabel(label); |
| 76 amount_text = CreateMediumLabel(amount); |
| 77 } else { |
| 78 label_text = base::MakeUnique<views::Label>(label); |
| 79 amount_text = base::MakeUnique<views::Label>(amount); |
| 80 } |
76 amount_text->set_id(static_cast<int>(amount_label_id)); | 81 amount_text->set_id(static_cast<int>(amount_label_id)); |
77 amount_text->SetMultiLine(true); | 82 amount_text->SetMultiLine(true); |
78 amount_text->SetAllowCharacterBreak(true); | 83 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 } | |
85 layout->AddView(label_text.release()); | 84 layout->AddView(label_text.release()); |
86 layout->AddView(amount_text.release()); | 85 layout->AddView(amount_text.release()); |
87 | 86 |
88 return row; | 87 return row; |
89 } | 88 } |
90 | 89 |
91 } // namespace | 90 } // namespace |
92 | 91 |
93 OrderSummaryViewController::OrderSummaryViewController( | 92 OrderSummaryViewController::OrderSummaryViewController( |
94 PaymentRequestSpec* spec, | 93 PaymentRequestSpec* spec, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 total_label_value, true, | 174 total_label_value, true, |
176 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) | 175 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) |
177 .release()); | 176 .release()); |
178 } | 177 } |
179 | 178 |
180 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { | 179 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { |
181 pay_button_->SetEnabled(enabled); | 180 pay_button_->SetEnabled(enabled); |
182 } | 181 } |
183 | 182 |
184 } // namespace payments | 183 } // namespace payments |
OLD | NEW |