| 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/payment_request_item_list.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_item_list.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 10 #include "components/payments/content/payment_request_state.h" | 10 #include "components/payments/content/payment_request_state.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return checkmark; | 65 return checkmark; |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateExtraView() { | 68 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateExtraView() { |
| 69 return nullptr; | 69 return nullptr; |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateItemView() { | 72 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateItemView() { |
| 73 std::unique_ptr<views::View> content = CreateContentView(); | 73 std::unique_ptr<views::View> content = CreateContentView(); |
| 74 | 74 |
| 75 std::unique_ptr<PaymentRequestRowView> row = | 75 const gfx::Insets row_insets( |
| 76 base::MakeUnique<PaymentRequestRowView>(this, | |
| 77 /* clickable= */ IsEnabled()); | |
| 78 views::GridLayout* layout = new views::GridLayout(row.get()); | |
| 79 row->SetLayoutManager(layout); | |
| 80 | |
| 81 layout->SetInsets( | |
| 82 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, | 76 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, |
| 83 kPaymentRequestRowVerticalInsets, | 77 kPaymentRequestRowVerticalInsets, |
| 84 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); | 78 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); |
| 79 std::unique_ptr<PaymentRequestRowView> row = |
| 80 base::MakeUnique<PaymentRequestRowView>(this, |
| 81 /* clickable= */ IsEnabled(), |
| 82 row_insets); |
| 83 views::GridLayout* layout = new views::GridLayout(row.get()); |
| 84 row->SetLayoutManager(layout); |
| 85 | 85 |
| 86 // Add a column for the item's content view. | 86 // Add a column for the item's content view. |
| 87 views::ColumnSet* columns = layout->AddColumnSet(0); | 87 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 88 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1, | 88 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1, |
| 89 views::GridLayout::USE_PREF, 0, 0); | 89 views::GridLayout::USE_PREF, 0, 0); |
| 90 | 90 |
| 91 columns->AddPaddingColumn(1, 0); | 91 columns->AddPaddingColumn(1, 0); |
| 92 | 92 |
| 93 // Add a column for the checkmark shown next to the selected profile. | 93 // Add a column for the checkmark shown next to the selected profile. |
| 94 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0, | 94 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // It's possible that no item is currently selected, either during list | 165 // It's possible that no item is currently selected, either during list |
| 166 // creation or in the middle of the selection operation when the previously | 166 // creation or in the middle of the selection operation when the previously |
| 167 // selected item has been deselected but the new one isn't selected yet. | 167 // selected item has been deselected but the new one isn't selected yet. |
| 168 if (selected_item_) | 168 if (selected_item_) |
| 169 selected_item_->SetSelected(/*selected=*/false, /*notify=*/true); | 169 selected_item_->SetSelected(/*selected=*/false, /*notify=*/true); |
| 170 | 170 |
| 171 selected_item_ = nullptr; | 171 selected_item_ = nullptr; |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace payments | 174 } // namespace payments |
| OLD | NEW |