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

Side by Side Diff: chrome/browser/ui/views/payments/payment_sheet_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/views/payments/payment_request_views_util.cc ('k') | ui/views/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/payment_sheet_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 17 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
17 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
19 #include "chrome/browser/ui/views/payments/payment_request_row_view.h"
18 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 20 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
19 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
20 #include "components/autofill/core/browser/autofill_data_util.h" 22 #include "components/autofill/core/browser/autofill_data_util.h"
21 #include "components/autofill/core/browser/autofill_type.h" 23 #include "components/autofill/core/browser/autofill_type.h"
22 #include "components/autofill/core/browser/credit_card.h" 24 #include "components/autofill/core/browser/credit_card.h"
23 #include "components/autofill/core/browser/field_types.h" 25 #include "components/autofill/core/browser/field_types.h"
24 #include "components/autofill/core/browser/personal_data_manager.h" 26 #include "components/autofill/core/browser/personal_data_manager.h"
25 #include "components/payments/currency_formatter.h" 27 #include "components/payments/currency_formatter.h"
26 #include "components/payments/payment_request.h" 28 #include "components/payments/payment_request.h"
27 #include "components/strings/grit/components_strings.h" 29 #include "components/strings/grit/components_strings.h"
28 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
29 #include "third_party/skia/include/core/SkColor.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/gfx/color_utils.h" 33 #include "ui/gfx/color_utils.h"
33 #include "ui/gfx/font.h" 34 #include "ui/gfx/font.h"
34 #include "ui/gfx/geometry/insets.h"
35 #include "ui/gfx/paint_vector_icon.h" 35 #include "ui/gfx/paint_vector_icon.h"
36 #include "ui/gfx/range/range.h" 36 #include "ui/gfx/range/range.h"
37 #include "ui/views/border.h" 37 #include "ui/views/border.h"
38 #include "ui/views/controls/button/custom_button.h"
39 #include "ui/views/controls/button/label_button.h" 38 #include "ui/views/controls/button/label_button.h"
40 #include "ui/views/controls/button/md_text_button.h" 39 #include "ui/views/controls/button/md_text_button.h"
41 #include "ui/views/controls/image_view.h" 40 #include "ui/views/controls/image_view.h"
42 #include "ui/views/controls/label.h" 41 #include "ui/views/controls/label.h"
43 #include "ui/views/controls/styled_label.h" 42 #include "ui/views/controls/styled_label.h"
44 #include "ui/views/layout/fill_layout.h" 43 #include "ui/views/layout/fill_layout.h"
45 #include "ui/views/layout/grid_layout.h" 44 #include "ui/views/layout/grid_layout.h"
46 #include "ui/views/resources/vector_icons/vector_icons.h" 45 #include "ui/views/resources/vector_icons/vector_icons.h"
47 #include "ui/views/view.h" 46 #include "ui/views/view.h"
48 47
49 namespace payments { 48 namespace payments {
50 namespace { 49 namespace {
51 50
52 constexpr int kFirstTagValue = static_cast<int>( 51 constexpr int kFirstTagValue = static_cast<int>(
53 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); 52 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
54 53
55 enum class PaymentSheetViewControllerTags { 54 enum class PaymentSheetViewControllerTags {
56 // The tag for the button that navigates to the Order Summary sheet. 55 // The tag for the button that navigates to the Order Summary sheet.
57 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue, 56 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue,
58 SHOW_SHIPPING_BUTTON, 57 SHOW_SHIPPING_BUTTON,
59 SHOW_PAYMENT_METHOD_BUTTON, 58 SHOW_PAYMENT_METHOD_BUTTON,
60 SHOW_CONTACT_INFO_BUTTON, 59 SHOW_CONTACT_INFO_BUTTON,
61 }; 60 };
62 61
63 // Creates a clickable row to be displayed in the Payment Sheet. It contains
64 // a section name and some content, followed by a chevron as a clickability
65 // affordance. Both, either, or none of |content_view| and |extra_content_view|
66 // may be present, the difference between the two being that content is pinned
67 // to the left and extra_content is pinned to the right.
68 // The row also displays a light gray horizontal ruler on its lower boundary.
69 // The name column has a fixed width equal to |name_column_width|.
70 // +----------------------------+
71 // | Name | Content | Extra | > |
72 // +~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ <-- ruler
73 class PaymentSheetRow : public views::CustomButton {
74 public:
75 PaymentSheetRow(views::ButtonListener* listener,
76 const base::string16& section_name,
77 std::unique_ptr<views::View> content_view,
78 std::unique_ptr<views::View> extra_content_view,
79 int name_column_width)
80 : views::CustomButton(listener) {
81 SetBorder(views::CreateSolidSidedBorder(0, 0, 1, 0, SK_ColorLTGRAY));
82 views::GridLayout* layout = new views::GridLayout(this);
83
84 constexpr int kRowVerticalInset = 8;
85 // The rows have extra inset compared to the header so that their right edge
86 // lines up with the close button's X rather than its invisible right edge.
87 constexpr int kRowExtraRightInset = 8;
88 layout->SetInsets(
89 kRowVerticalInset, 0, kRowVerticalInset, kRowExtraRightInset);
90 SetLayoutManager(layout);
91
92 views::ColumnSet* columns = layout->AddColumnSet(0);
93 // A column for the section name.
94 columns->AddColumn(views::GridLayout::LEADING,
95 views::GridLayout::LEADING,
96 0,
97 views::GridLayout::FIXED,
98 name_column_width,
99 0);
100
101 constexpr int kPaddingColumnsWidth = 25;
102 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
103
104 // A column for the content.
105 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING,
106 1, views::GridLayout::USE_PREF, 0, 0);
107 // A column for the extra content.
108 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
109 0, views::GridLayout::USE_PREF, 0, 0);
110
111 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
112 // A column for the chevron.
113 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
114 0, views::GridLayout::USE_PREF, 0, 0);
115
116 layout->StartRow(0, 0);
117 views::Label* name_label = new views::Label(section_name);
118 layout->AddView(name_label);
119
120 if (content_view) {
121 layout->AddView(content_view.release());
122 } else {
123 layout->SkipColumns(1);
124 }
125
126 if (extra_content_view) {
127 layout->AddView(extra_content_view.release());
128 } else {
129 layout->SkipColumns(1);
130 }
131
132 views::ImageView* chevron = new views::ImageView();
133 chevron->SetImage(gfx::CreateVectorIcon(
134 views::kSubmenuArrowIcon,
135 color_utils::DeriveDefaultIconColor(name_label->enabled_color())));
136 layout->AddView(chevron);
137 }
138
139 private:
140 DISALLOW_COPY_AND_ASSIGN(PaymentSheetRow);
141 };
142
143 int ComputeWidestNameColumnViewWidth() { 62 int ComputeWidestNameColumnViewWidth() {
144 // The name colums in each row should all have the same width, large enough to 63 // The name colums in each row should all have the same width, large enough to
145 // accomodate the longest piece of text they contain. Because of this, each 64 // accomodate the longest piece of text they contain. Because of this, each
146 // row's GridLayout requires its first column to have a fixed width of the 65 // row's GridLayout requires its first column to have a fixed width of the
147 // correct size. To measure the required size, layout a label with each 66 // correct size. To measure the required size, layout a label with each
148 // section name, measure its width, then initialize |widest_column_width| 67 // section name, measure its width, then initialize |widest_column_width|
149 // with the largest value. 68 // with the largest value.
150 std::vector<int> section_names{ 69 std::vector<int> section_names{
151 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME, 70 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME,
152 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME, 71 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME,
153 IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME}; 72 IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME};
154 73
155 int widest_column_width = 0; 74 int widest_column_width = 0;
156 75
157 views::Label label(base::ASCIIToUTF16("")); 76 views::Label label(base::ASCIIToUTF16(""));
158 for (int name_id : section_names) { 77 for (int name_id : section_names) {
159 label.SetText(l10n_util::GetStringUTF16(name_id)); 78 label.SetText(l10n_util::GetStringUTF16(name_id));
160 widest_column_width = std::max( 79 widest_column_width = std::max(
161 label.GetPreferredSize().width(), 80 label.GetPreferredSize().width(),
162 widest_column_width); 81 widest_column_width);
163 } 82 }
164 83
165 return widest_column_width; 84 return widest_column_width;
166 } 85 }
167 86
87 // Creates a clickable row to be displayed in the Payment Sheet. It contains
88 // a section name and some content, followed by a chevron as a clickability
89 // affordance. Both, either, or none of |content_view| and |extra_content_view|
90 // may be present, the difference between the two being that content is pinned
91 // to the left and extra_content is pinned to the right.
92 // The row also displays a light gray horizontal ruler on its lower boundary.
93 // The name column has a fixed width equal to |name_column_width|.
94 // +----------------------------+
95 // | Name | Content | Extra | > |
96 // +~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ <-- ruler
97 std::unique_ptr<views::Button> CreatePaymentSheetRow(
98 views::ButtonListener* listener,
99 const base::string16& section_name,
100 std::unique_ptr<views::View> content_view,
101 std::unique_ptr<views::View> extra_content_view,
102 int name_column_width) {
103 std::unique_ptr<PaymentRequestRowView> row =
104 base::MakeUnique<PaymentRequestRowView>(listener);
105 views::GridLayout* layout = new views::GridLayout(row.get());
106
107 // The rows have extra inset compared to the header so that their right edge
108 // lines up with the close button's X rather than its invisible right edge.
109 constexpr int kRowExtraRightInset = 8;
110 layout->SetInsets(kPaymentRequestRowVerticalInsets,
111 kPaymentRequestRowHorizontalInsets,
112 kPaymentRequestRowVerticalInsets,
113 kPaymentRequestRowHorizontalInsets + kRowExtraRightInset);
114 row->SetLayoutManager(layout);
115
116 views::ColumnSet* columns = layout->AddColumnSet(0);
117 // A column for the section name.
118 columns->AddColumn(views::GridLayout::LEADING,
119 views::GridLayout::LEADING,
120 0,
121 views::GridLayout::FIXED,
122 name_column_width,
123 0);
124
125 constexpr int kPaddingColumnsWidth = 25;
126 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
127
128 // A column for the content.
129 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING,
130 1, views::GridLayout::USE_PREF, 0, 0);
131 // A column for the extra content.
132 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
133 0, views::GridLayout::USE_PREF, 0, 0);
134
135 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
136 // A column for the chevron.
137 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
138 0, views::GridLayout::USE_PREF, 0, 0);
139
140 layout->StartRow(0, 0);
141 views::Label* name_label = new views::Label(section_name);
142 layout->AddView(name_label);
143
144 if (content_view) {
145 content_view->set_can_process_events_within_subtree(false);
146 layout->AddView(content_view.release());
147 } else {
148 layout->SkipColumns(1);
149 }
150
151 if (extra_content_view) {
152 extra_content_view->set_can_process_events_within_subtree(false);
153 layout->AddView(extra_content_view.release());
154 } else {
155 layout->SkipColumns(1);
156 }
157
158 views::ImageView* chevron = new views::ImageView();
159 chevron->set_interactive(false);
160 chevron->SetImage(gfx::CreateVectorIcon(
161 views::kSubmenuArrowIcon,
162 color_utils::DeriveDefaultIconColor(name_label->enabled_color())));
163 layout->AddView(chevron);
164
165 return std::move(row);
166 }
167
168 } // namespace 168 } // namespace
169 169
170 PaymentSheetViewController::PaymentSheetViewController( 170 PaymentSheetViewController::PaymentSheetViewController(
171 PaymentRequest* request, 171 PaymentRequest* request,
172 PaymentRequestDialogView* dialog) 172 PaymentRequestDialogView* dialog)
173 : PaymentRequestSheetController(request, dialog), 173 : PaymentRequestSheetController(request, dialog),
174 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) {} 174 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) {}
175 175
176 PaymentSheetViewController::~PaymentSheetViewController() {} 176 PaymentSheetViewController::~PaymentSheetViewController() {}
177 177
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return base::MakeUnique<views::Label>(label_value); 247 return base::MakeUnique<views::Label>(label_value);
248 } 248 }
249 249
250 // Creates the Order Summary row, which contains an "Order Summary" label, 250 // Creates the Order Summary row, which contains an "Order Summary" label,
251 // a Total Amount label, and a Chevron. 251 // a Total Amount label, and a Chevron.
252 // +----------------------------------------------+ 252 // +----------------------------------------------+
253 // | Order Summary Total USD $12.34 > | 253 // | Order Summary Total USD $12.34 > |
254 // +----------------------------------------------+ 254 // +----------------------------------------------+
255 std::unique_ptr<views::Button> 255 std::unique_ptr<views::Button>
256 PaymentSheetViewController::CreatePaymentSheetSummaryRow() { 256 PaymentSheetViewController::CreatePaymentSheetSummaryRow() {
257 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 257 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
258 this, 258 this,
259 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME), 259 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME),
260 std::unique_ptr<views::View>(nullptr), 260 std::unique_ptr<views::View>(nullptr),
261 CreateOrderSummarySectionContent(), 261 CreateOrderSummarySectionContent(),
262 widest_name_column_view_width_); 262 widest_name_column_view_width_);
263 section->set_tag(static_cast<int>( 263 section->set_tag(static_cast<int>(
264 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); 264 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON));
265 section->set_id( 265 section->set_id(
266 static_cast<int>(DialogViewID::PAYMENT_SHEET_SUMMARY_SECTION)); 266 static_cast<int>(DialogViewID::PAYMENT_SHEET_SUMMARY_SECTION));
267 return section; 267 return section;
(...skipping 11 matching lines...) Expand all
279 } 279 }
280 280
281 // Creates the Shipping row, which contains a "Shipping address" label, the 281 // Creates the Shipping row, which contains a "Shipping address" label, the
282 // user's selected shipping address, and a chevron. 282 // user's selected shipping address, and a chevron.
283 // +----------------------------------------------+ 283 // +----------------------------------------------+
284 // | Shipping Address Barack Obama | 284 // | Shipping Address Barack Obama |
285 // | 1600 Pennsylvania Ave. > | 285 // | 1600 Pennsylvania Ave. > |
286 // | 1800MYPOTUS | 286 // | 1800MYPOTUS |
287 // +----------------------------------------------+ 287 // +----------------------------------------------+
288 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { 288 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() {
289 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 289 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
290 this, 290 this,
291 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME), 291 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME),
292 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr), 292 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr),
293 widest_name_column_view_width_); 293 widest_name_column_view_width_);
294 section->set_tag( 294 section->set_tag(
295 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON)); 295 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON));
296 section->set_id( 296 section->set_id(
297 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_SECTION)); 297 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_SECTION));
298 return section; 298 return section;
299 } 299 }
(...skipping 23 matching lines...) Expand all
323 323
324 layout->StartRow(0, 0); 324 layout->StartRow(0, 0);
325 layout->AddView(new views::Label(selected_card->TypeAndLastFourDigits())); 325 layout->AddView(new views::Label(selected_card->TypeAndLastFourDigits()));
326 layout->StartRow(0, 0); 326 layout->StartRow(0, 0);
327 layout->AddView(new views::Label( 327 layout->AddView(new views::Label(
328 selected_card->GetInfo( 328 selected_card->GetInfo(
329 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), 329 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL),
330 g_browser_process->GetApplicationLocale()))); 330 g_browser_process->GetApplicationLocale())));
331 331
332 card_icon_view = base::MakeUnique<views::ImageView>(); 332 card_icon_view = base::MakeUnique<views::ImageView>();
333 card_icon_view->set_interactive(false);
333 card_icon_view->SetImage( 334 card_icon_view->SetImage(
334 ResourceBundle::GetSharedInstance() 335 ResourceBundle::GetSharedInstance()
335 .GetImageNamed(autofill::data_util::GetPaymentRequestData( 336 .GetImageNamed(autofill::data_util::GetPaymentRequestData(
336 selected_card->type()).icon_resource_id) 337 selected_card->type()).icon_resource_id)
337 .AsImageSkia()); 338 .AsImageSkia());
338 card_icon_view->SetBorder( 339 card_icon_view->SetBorder(
339 views::CreateRoundedRectBorder(1, 3, SK_ColorLTGRAY)); 340 views::CreateRoundedRectBorder(1, 3, SK_ColorLTGRAY));
340 341
341 constexpr gfx::Size kCardIconSize = gfx::Size(32, 20); 342 constexpr gfx::Size kCardIconSize = gfx::Size(32, 20);
342 card_icon_view->SetImageSize(kCardIconSize); 343 card_icon_view->SetImageSize(kCardIconSize);
343 } 344 }
344 345
345 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 346 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
346 this, 347 this,
347 l10n_util::GetStringUTF16( 348 l10n_util::GetStringUTF16(
348 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME), 349 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME),
349 std::move(content_view), 350 std::move(content_view),
350 std::move(card_icon_view), 351 std::move(card_icon_view),
351 widest_name_column_view_width_); 352 widest_name_column_view_width_);
352 section->set_tag(static_cast<int>( 353 section->set_tag(static_cast<int>(
353 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON)); 354 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON));
354 section->set_id( 355 section->set_id(
355 static_cast<int>(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION)); 356 static_cast<int>(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION));
(...skipping 12 matching lines...) Expand all
368 369
369 // Creates the Contact Info row, which contains a "Contact info" label; the 370 // Creates the Contact Info row, which contains a "Contact info" label; the
370 // name, email address, and/or phone number; and a chevron. 371 // name, email address, and/or phone number; and a chevron.
371 // +----------------------------------------------+ 372 // +----------------------------------------------+
372 // | Contact info Barack Obama | 373 // | Contact info Barack Obama |
373 // | 1800MYPOTUS > | 374 // | 1800MYPOTUS > |
374 // | potus@whitehouse.gov | 375 // | potus@whitehouse.gov |
375 // +----------------------------------------------+ 376 // +----------------------------------------------+
376 std::unique_ptr<views::Button> 377 std::unique_ptr<views::Button>
377 PaymentSheetViewController::CreateContactInfoRow() { 378 PaymentSheetViewController::CreateContactInfoRow() {
378 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 379 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
379 this, 380 this,
380 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME), 381 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME),
381 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), 382 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr),
382 widest_name_column_view_width_); 383 widest_name_column_view_width_);
383 section->set_tag(static_cast<int>( 384 section->set_tag(static_cast<int>(
384 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); 385 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON));
385 section->set_id( 386 section->set_id(
386 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); 387 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION));
387 return section; 388 return section;
388 } 389 }
389 390
390 } // namespace payments 391 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_views_util.cc ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698