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

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

Issue 2656853002: [Web Payments] Refactor the row display code. (Closed)
Patch Set: Address feedback. Created 3 years, 10 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 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 // Creates a view for a line item to be displayed in the Order Summary Sheet. 33 // Creates a view for a line item to be displayed in the Order Summary Sheet.
34 // |label| is the text in the left-aligned label and |amount| is the text of the 34 // |label| is the text in the left-aligned label and |amount| is the text of the
35 // right-aliged label in the row. The |amount| text is bold if |bold_amount| is 35 // right-aliged label in the row. The |amount| text is bold if |bold_amount| is
36 // true, which is only the case for the last row containing the total of the 36 // true, which is only the case for the last row containing the total of the
37 // order. 37 // order.
38 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label, 38 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label,
39 const base::string16& amount, 39 const base::string16& amount,
40 bool bold_amount) { 40 bool bold_amount) {
41 std::unique_ptr<views::View> row = base::MakeUnique<views::View>(); 41 std::unique_ptr<views::View> row = base::MakeUnique<views::View>();
42 42
43 row->SetBorder(views::CreateSolidSidedBorder(0, 0, 1, 0, SK_ColorLTGRAY)); 43 row->SetBorder(payments::CreatePaymentRequestRowBorder());
44 44
45 views::GridLayout* layout = new views::GridLayout(row.get()); 45 views::GridLayout* layout = new views::GridLayout(row.get());
46 46
47 // The vertical spacing for these rows is slightly different than the spacing
48 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets.
47 constexpr int kRowVerticalInset = 12; 49 constexpr int kRowVerticalInset = 12;
48 layout->SetInsets(kRowVerticalInset, 0, kRowVerticalInset, 0); 50 layout->SetInsets(kRowVerticalInset,
51 payments::kPaymentRequestRowHorizontalInsets,
52 kRowVerticalInset,
53 payments::kPaymentRequestRowHorizontalInsets);
49 54
50 row->SetLayoutManager(layout); 55 row->SetLayoutManager(layout);
51 views::ColumnSet* columns = layout->AddColumnSet(0); 56 views::ColumnSet* columns = layout->AddColumnSet(0);
52 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 57 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
53 0, views::GridLayout::USE_PREF, 0, 0); 58 0, views::GridLayout::USE_PREF, 0, 0);
54 columns->AddPaddingColumn(1, 0); 59 columns->AddPaddingColumn(1, 0);
55 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 60 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
56 0, views::GridLayout::USE_PREF, 0, 0); 61 0, views::GridLayout::USE_PREF, 0, 0);
57 62
58 layout->StartRow(0, 0); 63 layout->StartRow(0, 0);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 break; 132 break;
128 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG): 133 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG):
129 dialog()->GoBack(); 134 dialog()->GoBack();
130 break; 135 break;
131 default: 136 default:
132 NOTREACHED(); 137 NOTREACHED();
133 } 138 }
134 } 139 }
135 140
136 } // namespace payments 141 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698