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

Side by Side Diff: chrome/browser/ui/views/payments/order_summary_view_controller.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 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 29 matching lines...) Expand all
40 // tests. 40 // 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 bold_amount, 43 bool bold_amount,
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()); 47 row->SetBorder(payments::CreatePaymentRequestRowBorder());
48 48
49 views::GridLayout* layout = new views::GridLayout(row.get()); 49 views::GridLayout* layout = new views::GridLayout(row.get());
50 row->SetLayoutManager(layout);
50 51
51 // The vertical spacing for these rows is slightly different than the spacing 52 // The vertical spacing for these rows is slightly different than the spacing
52 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets. 53 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets.
53 constexpr int kRowVerticalInset = 12; 54 constexpr int kRowVerticalInset = 12;
54 layout->SetInsets(kRowVerticalInset, 55 row->SetBorder(views::CreateEmptyBorder(
55 payments::kPaymentRequestRowHorizontalInsets, 56 kRowVerticalInset, payments::kPaymentRequestRowHorizontalInsets,
56 kRowVerticalInset, 57 kRowVerticalInset, payments::kPaymentRequestRowHorizontalInsets));
57 payments::kPaymentRequestRowHorizontalInsets);
58 58
59 row->SetLayoutManager(layout);
60 views::ColumnSet* columns = layout->AddColumnSet(0); 59 views::ColumnSet* columns = layout->AddColumnSet(0);
61 // The first column has resize_percent = 1 so that it streches all the way 60 // The first column has resize_percent = 1 so that it streches all the way
62 // across the row up to the amount label. This way the first label elides as 61 // across the row up to the amount label. This way the first label elides as
63 // required. 62 // required.
64 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, 63 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
65 views::GridLayout::USE_PREF, 0, 0); 64 views::GridLayout::USE_PREF, 0, 0);
66 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 65 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
67 0, views::GridLayout::USE_PREF, 0, 0); 66 0, views::GridLayout::USE_PREF, 0, 0);
68 67
69 layout->StartRow(0, 0); 68 layout->StartRow(0, 0);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 total_label_value, true, 157 total_label_value, true,
159 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL) 158 DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL)
160 .release()); 159 .release());
161 } 160 }
162 161
163 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) { 162 void OrderSummaryViewController::UpdatePayButtonState(bool enabled) {
164 pay_button_->SetEnabled(enabled); 163 pay_button_->SetEnabled(enabled);
165 } 164 }
166 165
167 } // namespace payments 166 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698