Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1097)

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_item_list.cc

Issue 2859193004: Remove GridLayout::SetInsets in favor of an empty border on the host. (Closed)
Patch Set: edits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ui/gfx/paint_vector_icon.h" 11 #include "ui/gfx/paint_vector_icon.h"
12 #include "ui/views/border.h"
12 #include "ui/views/controls/image_view.h" 13 #include "ui/views/controls/image_view.h"
13 #include "ui/views/layout/box_layout.h" 14 #include "ui/views/layout/box_layout.h"
14 #include "ui/views/layout/grid_layout.h" 15 #include "ui/views/layout/grid_layout.h"
15 #include "ui/views/vector_icons.h" 16 #include "ui/views/vector_icons.h"
16 #include "ui/views/view.h" 17 #include "ui/views/view.h"
17 18
18 namespace payments { 19 namespace payments {
19 20
20 namespace { 21 namespace {
21 22
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 72
72 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateItemView() { 73 std::unique_ptr<views::View> PaymentRequestItemList::Item::CreateItemView() {
73 std::unique_ptr<views::View> content = CreateContentView(); 74 std::unique_ptr<views::View> content = CreateContentView();
74 75
75 std::unique_ptr<PaymentRequestRowView> row = 76 std::unique_ptr<PaymentRequestRowView> row =
76 base::MakeUnique<PaymentRequestRowView>(this, 77 base::MakeUnique<PaymentRequestRowView>(this,
77 /* clickable= */ IsEnabled()); 78 /* clickable= */ IsEnabled());
78 views::GridLayout* layout = new views::GridLayout(row.get()); 79 views::GridLayout* layout = new views::GridLayout(row.get());
79 row->SetLayoutManager(layout); 80 row->SetLayoutManager(layout);
80 81
81 layout->SetInsets( 82 row->SetBorder(views::CreateEmptyBorder(
82 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets, 83 kPaymentRequestRowVerticalInsets, kPaymentRequestRowHorizontalInsets,
83 kPaymentRequestRowVerticalInsets, 84 kPaymentRequestRowVerticalInsets,
84 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset); 85 kPaymentRequestRowHorizontalInsets + kPaymentRequestRowExtraRightInset));
85 86
86 // Add a column for the item's content view. 87 // Add a column for the item's content view.
87 views::ColumnSet* columns = layout->AddColumnSet(0); 88 views::ColumnSet* columns = layout->AddColumnSet(0);
88 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1, 89 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1,
89 views::GridLayout::USE_PREF, 0, 0); 90 views::GridLayout::USE_PREF, 0, 0);
90 91
91 columns->AddPaddingColumn(1, 0); 92 columns->AddPaddingColumn(1, 0);
92 93
93 // Add a column for the checkmark shown next to the selected profile. 94 // Add a column for the checkmark shown next to the selected profile.
94 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0, 95 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 0,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // It's possible that no item is currently selected, either during list 166 // 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 167 // 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. 168 // selected item has been deselected but the new one isn't selected yet.
168 if (selected_item_) 169 if (selected_item_)
169 selected_item_->SetSelected(/*selected=*/false, /*notify=*/true); 170 selected_item_->SetSelected(/*selected=*/false, /*notify=*/true);
170 171
171 selected_item_ = nullptr; 172 selected_item_ = nullptr;
172 } 173 }
173 174
174 } // namespace payments 175 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698