| 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 26 matching lines...) Expand all Loading... |
| 37 // right-aliged label in the row. The |amount| and |label| texts are emphasized | 37 // right-aliged label in the row. The |amount| and |label| texts are emphasized |
| 38 // if |emphasize| is true, which is only the case for the last row containing | 38 // if |emphasize| is true, which is only the case for the last row containing |
| 39 // the total of the order. |amount_label_id| is specified to recall the view | 39 // the total of the order. |amount_label_id| is specified to recall the view |
| 40 // later, e.g. in tests. | 40 // later, e.g. in tests. |
| 41 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label, | 41 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label, |
| 42 const base::string16& amount, | 42 const base::string16& amount, |
| 43 bool emphasize, | 43 bool emphasize, |
| 44 DialogViewID amount_label_id) { | 44 DialogViewID amount_label_id) { |
| 45 std::unique_ptr<views::View> row = base::MakeUnique<views::View>(); | 45 std::unique_ptr<views::View> row = base::MakeUnique<views::View>(); |
| 46 | 46 |
| 47 row->SetBorder(payments::CreatePaymentRequestRowBorder( | |
| 48 row->GetNativeTheme()->GetSystemColor( | |
| 49 ui::NativeTheme::kColorId_SeparatorColor))); | |
| 50 | |
| 51 views::GridLayout* layout = new views::GridLayout(row.get()); | |
| 52 | |
| 53 // The vertical spacing for these rows is slightly different than the spacing | 47 // The vertical spacing for these rows is slightly different than the spacing |
| 54 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets. | 48 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets. |
| 55 constexpr int kRowVerticalInset = 4; | 49 constexpr int kRowVerticalInset = 4; |
| 56 layout->SetInsets(kRowVerticalInset, | 50 const gfx::Insets row_insets( |
| 57 payments::kPaymentRequestRowHorizontalInsets, | 51 kRowVerticalInset, payments::kPaymentRequestRowHorizontalInsets, |
| 58 kRowVerticalInset, | 52 kRowVerticalInset, payments::kPaymentRequestRowHorizontalInsets); |
| 59 payments::kPaymentRequestRowHorizontalInsets); | 53 row->SetBorder(payments::CreatePaymentRequestRowBorder( |
| 54 row->GetNativeTheme()->GetSystemColor( |
| 55 ui::NativeTheme::kColorId_SeparatorColor), |
| 56 row_insets)); |
| 60 | 57 |
| 58 views::GridLayout* layout = new views::GridLayout(row.get()); |
| 61 row->SetLayoutManager(layout); | 59 row->SetLayoutManager(layout); |
| 60 |
| 62 views::ColumnSet* columns = layout->AddColumnSet(0); | 61 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 63 // 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 |
| 64 // 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 |
| 65 // required. | 64 // required. |
| 66 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, | 65 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, |
| 67 views::GridLayout::USE_PREF, 0, 0); | 66 views::GridLayout::USE_PREF, 0, 0); |
| 68 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 67 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| 69 views::GridLayout::FIXED, kAmountSectionWidth, | 68 views::GridLayout::FIXED, kAmountSectionWidth, |
| 70 kAmountSectionWidth); | 69 kAmountSectionWidth); |
| 71 | 70 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 total_label_value, true, | 162 total_label_value, true, |
| 164 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) | 163 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) |
| 165 .release()); | 164 .release()); |
| 166 } | 165 } |
| 167 | 166 |
| 168 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { | 167 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { |
| 169 pay_button_->SetEnabled(enabled); | 168 pay_button_->SetEnabled(enabled); |
| 170 } | 169 } |
| 171 | 170 |
| 172 } // namespace payments | 171 } // namespace payments |
| OLD | NEW |