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

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: Rebase 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/payments/payment_request_row_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 // right-aliged label in the row. The |amount| text is bold if |bold_amount| is 36 // right-aliged label in the row. The |amount| text is bold if |bold_amount| is
37 // true, which is only the case for the last row containing the total of the 37 // true, which is only the case for the last row containing the total of the
38 // order. |amount_label_id| is specified to recall the view later, e.g. in 38 // order. |amount_label_id| is specified to recall the view later, e.g. in
39 // tests. 39 // tests.
40 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label, 40 std::unique_ptr<views::View> CreateLineItemView(const base::string16& label,
41 const base::string16& amount, 41 const base::string16& amount,
42 bool bold_amount, 42 bool bold_amount,
43 DialogViewID amount_label_id) { 43 DialogViewID amount_label_id) {
44 std::unique_ptr<views::View> row = base::MakeUnique<views::View>(); 44 std::unique_ptr<views::View> row = base::MakeUnique<views::View>();
45 45
46 row->SetBorder(views::CreateSolidSidedBorder(0, 0, 1, 0, SK_ColorLTGRAY)); 46 row->SetBorder(payments::CreatePaymentRequestRowBorder());
47 47
48 views::GridLayout* layout = new views::GridLayout(row.get()); 48 views::GridLayout* layout = new views::GridLayout(row.get());
49 49
50 // The vertical spacing for these rows is slightly different than the spacing
51 // spacing for clickable rows, so don't use kPaymentRequestRowVerticalInsets.
50 constexpr int kRowVerticalInset = 12; 52 constexpr int kRowVerticalInset = 12;
51 layout->SetInsets(kRowVerticalInset, 0, kRowVerticalInset, 0); 53 layout->SetInsets(kRowVerticalInset,
54 payments::kPaymentRequestRowHorizontalInsets,
55 kRowVerticalInset,
56 payments::kPaymentRequestRowHorizontalInsets);
52 57
53 row->SetLayoutManager(layout); 58 row->SetLayoutManager(layout);
54 views::ColumnSet* columns = layout->AddColumnSet(0); 59 views::ColumnSet* columns = layout->AddColumnSet(0);
55 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 60 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
56 0, views::GridLayout::USE_PREF, 0, 0); 61 0, views::GridLayout::USE_PREF, 0, 0);
57 columns->AddPaddingColumn(1, 0); 62 columns->AddPaddingColumn(1, 0);
58 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 63 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
59 0, views::GridLayout::USE_PREF, 0, 0); 64 0, views::GridLayout::USE_PREF, 0, 0);
60 65
61 layout->StartRow(0, 0); 66 layout->StartRow(0, 0);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 break; 147 break;
143 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG): 148 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG):
144 dialog()->GoBack(); 149 dialog()->GoBack();
145 break; 150 break;
146 default: 151 default:
147 NOTREACHED(); 152 NOTREACHED();
148 } 153 }
149 } 154 }
150 155
151 } // namespace payments 156 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/payments/payment_request_row_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698