| 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/payment_sheet_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 std::unique_ptr<views::Button> CreatePaymentSheetRow( | 148 std::unique_ptr<views::Button> CreatePaymentSheetRow( |
| 149 views::ButtonListener* listener, | 149 views::ButtonListener* listener, |
| 150 const base::string16& section_name, | 150 const base::string16& section_name, |
| 151 std::unique_ptr<views::View> content_view, | 151 std::unique_ptr<views::View> content_view, |
| 152 std::unique_ptr<views::View> extra_content_view, | 152 std::unique_ptr<views::View> extra_content_view, |
| 153 std::unique_ptr<views::View> trailing_button, | 153 std::unique_ptr<views::View> trailing_button, |
| 154 bool clickable, | 154 bool clickable, |
| 155 bool extra_trailing_inset, | 155 bool extra_trailing_inset, |
| 156 int name_column_width) { | 156 int name_column_width) { |
| 157 const int trailing_inset = extra_trailing_inset |
| 158 ? kPaymentRequestRowHorizontalInsets + |
| 159 kPaymentRequestRowExtraRightInset |
| 160 : kPaymentRequestRowHorizontalInsets; |
| 161 const gfx::Insets row_insets( |
| 162 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, |
| 163 kPaymentRequestRowVerticalInsets, trailing_inset); |
| 157 std::unique_ptr<PaymentRequestRowView> row = | 164 std::unique_ptr<PaymentRequestRowView> row = |
| 158 base::MakeUnique<PaymentRequestRowView>(listener, clickable); | 165 base::MakeUnique<PaymentRequestRowView>(listener, clickable, row_insets); |
| 159 views::GridLayout* layout = new views::GridLayout(row.get()); | 166 views::GridLayout* layout = new views::GridLayout(row.get()); |
| 160 | |
| 161 int trailing_inset = extra_trailing_inset | |
| 162 ? kPaymentRequestRowHorizontalInsets + | |
| 163 kPaymentRequestRowExtraRightInset | |
| 164 : kPaymentRequestRowHorizontalInsets; | |
| 165 layout->SetInsets(kPaymentRequestRowVerticalInsets, | |
| 166 kPaymentRequestRowHorizontalInsets, | |
| 167 kPaymentRequestRowVerticalInsets, trailing_inset); | |
| 168 row->SetLayoutManager(layout); | 167 row->SetLayoutManager(layout); |
| 169 | 168 |
| 170 views::ColumnSet* columns = layout->AddColumnSet(0); | 169 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 171 // A column for the section name. | 170 // A column for the section name. |
| 172 columns->AddColumn(views::GridLayout::LEADING, | 171 columns->AddColumn(views::GridLayout::LEADING, |
| 173 views::GridLayout::LEADING, | 172 views::GridLayout::LEADING, |
| 174 0, | 173 0, |
| 175 views::GridLayout::FIXED, | 174 views::GridLayout::FIXED, |
| 176 name_column_width, | 175 name_column_width, |
| 177 0); | 176 0); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 } else { | 887 } else { |
| 889 return builder | 888 return builder |
| 890 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON) | 889 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON) |
| 891 .CreateWithButton( | 890 .CreateWithButton( |
| 892 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS), | 891 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS), |
| 893 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false); | 892 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false); |
| 894 } | 893 } |
| 895 } | 894 } |
| 896 | 895 |
| 897 } // namespace payments | 896 } // namespace payments |
| OLD | NEW |