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

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: Created 3 years, 11 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/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.h" 17 #include "chrome/browser/ui/views/payments/payment_request_dialog.h"
18 #include "chrome/browser/ui/views/payments/payment_request_row_view.h"
17 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 19 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
18 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
19 #include "components/autofill/core/browser/autofill_data_util.h" 21 #include "components/autofill/core/browser/autofill_data_util.h"
20 #include "components/autofill/core/browser/autofill_type.h" 22 #include "components/autofill/core/browser/autofill_type.h"
21 #include "components/autofill/core/browser/credit_card.h" 23 #include "components/autofill/core/browser/credit_card.h"
22 #include "components/autofill/core/browser/field_types.h" 24 #include "components/autofill/core/browser/field_types.h"
23 #include "components/autofill/core/browser/personal_data_manager.h" 25 #include "components/autofill/core/browser/personal_data_manager.h"
24 #include "components/payments/currency_formatter.h" 26 #include "components/payments/currency_formatter.h"
25 #include "components/payments/payment_request.h" 27 #include "components/payments/payment_request.h"
26 #include "components/strings/grit/components_strings.h" 28 #include "components/strings/grit/components_strings.h"
27 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
28 #include "third_party/skia/include/core/SkColor.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/color_utils.h" 32 #include "ui/gfx/color_utils.h"
32 #include "ui/gfx/font.h" 33 #include "ui/gfx/font.h"
33 #include "ui/gfx/geometry/insets.h"
34 #include "ui/gfx/paint_vector_icon.h" 34 #include "ui/gfx/paint_vector_icon.h"
35 #include "ui/gfx/range/range.h" 35 #include "ui/gfx/range/range.h"
36 #include "ui/views/border.h" 36 #include "ui/views/border.h"
37 #include "ui/views/controls/button/custom_button.h"
38 #include "ui/views/controls/button/label_button.h" 37 #include "ui/views/controls/button/label_button.h"
39 #include "ui/views/controls/button/md_text_button.h" 38 #include "ui/views/controls/button/md_text_button.h"
40 #include "ui/views/controls/image_view.h" 39 #include "ui/views/controls/image_view.h"
41 #include "ui/views/controls/label.h" 40 #include "ui/views/controls/label.h"
42 #include "ui/views/controls/styled_label.h" 41 #include "ui/views/controls/styled_label.h"
43 #include "ui/views/layout/fill_layout.h" 42 #include "ui/views/layout/fill_layout.h"
44 #include "ui/views/layout/grid_layout.h" 43 #include "ui/views/layout/grid_layout.h"
45 #include "ui/views/resources/vector_icons/vector_icons.h" 44 #include "ui/views/resources/vector_icons/vector_icons.h"
46 #include "ui/views/view.h" 45 #include "ui/views/view.h"
47 46
48 namespace payments { 47 namespace payments {
49 namespace { 48 namespace {
50 49
51 constexpr int kFirstTagValue = static_cast<int>( 50 constexpr int kFirstTagValue = static_cast<int>(
52 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); 51 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
53 52
54 enum class PaymentSheetViewControllerTags { 53 enum class PaymentSheetViewControllerTags {
55 // The tag for the button that navigates to the Order Summary sheet. 54 // The tag for the button that navigates to the Order Summary sheet.
56 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue, 55 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue,
57 SHOW_SHIPPING_BUTTON, 56 SHOW_SHIPPING_BUTTON,
58 SHOW_PAYMENT_METHOD_BUTTON, 57 SHOW_PAYMENT_METHOD_BUTTON,
59 SHOW_CONTACT_INFO_BUTTON, 58 SHOW_CONTACT_INFO_BUTTON,
60 }; 59 };
61 60
62 // Creates a clickable row to be displayed in the Payment Sheet. It contains 61 // This class's sole purpose is to prevent event processing by subviews of
63 // a section name and some content, followed by a chevron as a clickability 62 // clickable rows in the dialog. This is required to make sure that hover and
64 // affordance. Both, either, or none of |content_view| and |extra_content_view| 63 // click events propagate to the row itself.
65 // may be present, the difference between the two being that content is pinned 64 class NoEventView : public views::View {
66 // to the left and extra_content is pinned to the right.
67 // The row also displays a light gray horizontal ruler on its lower boundary.
68 // The name column has a fixed width equal to |name_column_width|.
69 // +----------------------------+
70 // | Name | Content | Extra | > |
71 // +~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ <-- ruler
72 class PaymentSheetRow : public views::CustomButton {
73 public: 65 public:
74 PaymentSheetRow(views::ButtonListener* listener, 66 NoEventView() {
75 const base::string16& section_name, 67 SetLayoutManager(new views::FillLayout);
76 std::unique_ptr<views::View> content_view,
77 std::unique_ptr<views::View> extra_content_view,
78 int name_column_width)
79 : views::CustomButton(listener) {
80 SetBorder(views::CreateSolidSidedBorder(0, 0, 1, 0, SK_ColorLTGRAY));
81 views::GridLayout* layout = new views::GridLayout(this);
82
83 constexpr int kRowVerticalInset = 8;
84 // The rows have extra inset compared to the header so that their right edge
85 // lines up with the close button's X rather than its invisible right edge.
86 constexpr int kRowExtraRightInset = 8;
87 layout->SetInsets(
88 kRowVerticalInset, 0, kRowVerticalInset, kRowExtraRightInset);
89 SetLayoutManager(layout);
90
91 views::ColumnSet* columns = layout->AddColumnSet(0);
92 // A column for the section name.
93 columns->AddColumn(views::GridLayout::LEADING,
94 views::GridLayout::LEADING,
95 0,
96 views::GridLayout::FIXED,
97 name_column_width,
98 0);
99
100 constexpr int kPaddingColumnsWidth = 25;
101 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
102
103 // A column for the content.
104 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING,
105 1, views::GridLayout::USE_PREF, 0, 0);
106 // A column for the extra content.
107 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
108 0, views::GridLayout::USE_PREF, 0, 0);
109
110 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
111 // A column for the chevron.
112 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
113 0, views::GridLayout::USE_PREF, 0, 0);
114
115 layout->StartRow(0, 0);
116 views::Label* name_label = new views::Label(section_name);
117 layout->AddView(name_label);
118
119 if (content_view) {
120 layout->AddView(content_view.release());
121 } else {
122 layout->SkipColumns(1);
123 }
124
125 if (extra_content_view) {
126 layout->AddView(extra_content_view.release());
127 } else {
128 layout->SkipColumns(1);
129 }
130
131 views::ImageView* chevron = new views::ImageView();
132 chevron->SetImage(gfx::CreateVectorIcon(
133 views::kSubmenuArrowIcon,
134 color_utils::DeriveDefaultIconColor(name_label->enabled_color())));
135 layout->AddView(chevron);
136 } 68 }
137 69
70 protected:
71 bool CanProcessEventsWithinSubtree() const override { return false; }
72
138 private: 73 private:
139 DISALLOW_COPY_AND_ASSIGN(PaymentSheetRow); 74 DISALLOW_COPY_AND_ASSIGN(NoEventView);
140 }; 75 };
141 76
142 int ComputeWidestNameColumnViewWidth() { 77 int ComputeWidestNameColumnViewWidth() {
143 // The name colums in each row should all have the same width, large enough to 78 // The name colums in each row should all have the same width, large enough to
144 // accomodate the longest piece of text they contain. Because of this, each 79 // accomodate the longest piece of text they contain. Because of this, each
145 // row's GridLayout requires its first column to have a fixed width of the 80 // row's GridLayout requires its first column to have a fixed width of the
146 // correct size. To measure the required size, layout a label with each 81 // correct size. To measure the required size, layout a label with each
147 // section name, measure its width, then initialize |widest_column_width| 82 // section name, measure its width, then initialize |widest_column_width|
148 // with the largest value. 83 // with the largest value.
149 std::vector<int> section_names{ 84 std::vector<int> section_names{
150 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME, 85 IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME,
151 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME, 86 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME,
152 IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME}; 87 IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME};
153 88
154 int widest_column_width = 0; 89 int widest_column_width = 0;
155 90
156 views::Label label(base::ASCIIToUTF16("")); 91 views::Label label(base::ASCIIToUTF16(""));
157 for (int name_id : section_names) { 92 for (int name_id : section_names) {
158 label.SetText(l10n_util::GetStringUTF16(name_id)); 93 label.SetText(l10n_util::GetStringUTF16(name_id));
159 widest_column_width = std::max( 94 widest_column_width = std::max(
160 label.GetPreferredSize().width(), 95 label.GetPreferredSize().width(),
161 widest_column_width); 96 widest_column_width);
162 } 97 }
163 98
164 return widest_column_width; 99 return widest_column_width;
165 } 100 }
166 101
102 // Creates a clickable row to be displayed in the Payment Sheet. It contains
103 // a section name and some content, followed by a chevron as a clickability
104 // affordance. Both, either, or none of |content_view| and |extra_content_view|
105 // may be present, the difference between the two being that content is pinned
106 // to the left and extra_content is pinned to the right.
107 // The row also displays a light gray horizontal ruler on its lower boundary.
108 // The name column has a fixed width equal to |name_column_width|.
109 // +----------------------------+
110 // | Name | Content | Extra | > |
111 // +~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ <-- ruler
112 std::unique_ptr<views::Button> CreatePaymentSheetRow(
113 views::ButtonListener* listener,
114 const base::string16& section_name,
115 std::unique_ptr<views::View> content_view,
116 std::unique_ptr<views::View> extra_content_view,
117 int name_column_width) {
118 std::unique_ptr<PaymentRequestRowView> row =
119 base::MakeUnique<PaymentRequestRowView>(listener);
120 views::GridLayout* layout = new views::GridLayout(row.get());
121
122 // The rows have extra inset compared to the header so that their right edge
123 // lines up with the close button's X rather than its invisible right edge.
124 constexpr int kRowExtraRightInset = 8;
125 layout->SetInsets(kPaymentRequestRowVerticalInsets,
126 kPaymentRequestRowHorizontalInsets,
127 kPaymentRequestRowVerticalInsets,
128 kPaymentRequestRowHorizontalInsets + kRowExtraRightInset);
129 row->SetLayoutManager(layout);
130
131 views::ColumnSet* columns = layout->AddColumnSet(0);
132 // A column for the section name.
133 columns->AddColumn(views::GridLayout::LEADING,
134 views::GridLayout::LEADING,
135 0,
136 views::GridLayout::FIXED,
137 name_column_width,
138 0);
139
140 constexpr int kPaddingColumnsWidth = 25;
141 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
142
143 // A column for the content.
144 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING,
145 1, views::GridLayout::USE_PREF, 0, 0);
146 // A column for the extra content.
147 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
148 0, views::GridLayout::USE_PREF, 0, 0);
149
150 columns->AddPaddingColumn(0, kPaddingColumnsWidth);
151 // A column for the chevron.
152 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
153 0, views::GridLayout::USE_PREF, 0, 0);
154
155 layout->StartRow(0, 0);
156 views::Label* name_label = new views::Label(section_name);
157 layout->AddView(name_label);
158
159 if (content_view) {
160 // Wrap this view in a NoEventView so that the contained subviews don't
161 // process click/hover events themselves.
162 std::unique_ptr<NoEventView> container = base::MakeUnique<NoEventView>();
163 container->AddChildView(content_view.release());
164 layout->AddView(container.release());
165 } else {
166 layout->SkipColumns(1);
167 }
168
169 if (extra_content_view) {
170 // Wrap this view in a NoEventView so that the contained subviews don't
171 // process click/hover events themselves.
172 std::unique_ptr<NoEventView> container = base::MakeUnique<NoEventView>();
173 container->AddChildView(extra_content_view.release());
174 layout->AddView(container.release());
175 } else {
176 layout->SkipColumns(1);
177 }
178
179 views::ImageView* chevron = new views::ImageView();
180 chevron->set_interactive(false);
181 chevron->SetImage(gfx::CreateVectorIcon(
182 views::kSubmenuArrowIcon,
183 color_utils::DeriveDefaultIconColor(name_label->enabled_color())));
184 layout->AddView(chevron);
185
186 return std::move(row);
187 }
188
167 } // namespace 189 } // namespace
168 190
169 PaymentSheetViewController::PaymentSheetViewController( 191 PaymentSheetViewController::PaymentSheetViewController(
170 PaymentRequest* request, 192 PaymentRequest* request,
171 PaymentRequestDialog* dialog) 193 PaymentRequestDialog* dialog)
172 : PaymentRequestSheetController(request, dialog), 194 : PaymentRequestSheetController(request, dialog),
173 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) {} 195 widest_name_column_view_width_(ComputeWidestNameColumnViewWidth()) {}
174 196
175 PaymentSheetViewController::~PaymentSheetViewController() {} 197 PaymentSheetViewController::~PaymentSheetViewController() {}
176 198
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return base::MakeUnique<views::Label>(label_value); 268 return base::MakeUnique<views::Label>(label_value);
247 } 269 }
248 270
249 // Creates the Order Summary row, which contains an "Order Summary" label, 271 // Creates the Order Summary row, which contains an "Order Summary" label,
250 // a Total Amount label, and a Chevron. 272 // a Total Amount label, and a Chevron.
251 // +----------------------------------------------+ 273 // +----------------------------------------------+
252 // | Order Summary Total USD $12.34 > | 274 // | Order Summary Total USD $12.34 > |
253 // +----------------------------------------------+ 275 // +----------------------------------------------+
254 std::unique_ptr<views::Button> 276 std::unique_ptr<views::Button>
255 PaymentSheetViewController::CreatePaymentSheetSummaryRow() { 277 PaymentSheetViewController::CreatePaymentSheetSummaryRow() {
256 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 278 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
257 this, 279 this,
258 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME), 280 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME),
259 std::unique_ptr<views::View>(nullptr), 281 std::unique_ptr<views::View>(nullptr),
260 CreateOrderSummarySectionContent(), 282 CreateOrderSummarySectionContent(),
261 widest_name_column_view_width_); 283 widest_name_column_view_width_);
262 section->set_tag(static_cast<int>( 284 section->set_tag(static_cast<int>(
263 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); 285 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON));
264 return section; 286 return section;
265 } 287 }
266 288
267 std::unique_ptr<views::View> 289 std::unique_ptr<views::View>
268 PaymentSheetViewController::CreateShippingSectionContent() { 290 PaymentSheetViewController::CreateShippingSectionContent() {
269 auto profile = request()->GetCurrentlySelectedProfile(); 291 auto profile = request()->GetCurrentlySelectedProfile();
270 292
271 // TODO(tmartino): Empty string param is app locale; this should be passed 293 // TODO(tmartino): Empty string param is app locale; this should be passed
272 // at construct-time and stored as a member in a future CL. 294 // at construct-time and stored as a member in a future CL.
273 return profile ? payments::GetShippingAddressLabel(AddressStyleType::SUMMARY, 295 return profile ? payments::GetShippingAddressLabel(AddressStyleType::SUMMARY,
274 std::string(), *profile) 296 std::string(), *profile)
275 : base::MakeUnique<views::Label>(base::string16()); 297 : base::MakeUnique<views::Label>(base::string16());
276 } 298 }
277 299
278 // Creates the Shipping row, which contains a "Shipping address" label, the 300 // Creates the Shipping row, which contains a "Shipping address" label, the
279 // user's selected shipping address, and a chevron. 301 // user's selected shipping address, and a chevron.
280 // +----------------------------------------------+ 302 // +----------------------------------------------+
281 // | Shipping Address Barack Obama | 303 // | Shipping Address Barack Obama |
282 // | 1600 Pennsylvania Ave. > | 304 // | 1600 Pennsylvania Ave. > |
283 // | 1800MYPOTUS | 305 // | 1800MYPOTUS |
284 // +----------------------------------------------+ 306 // +----------------------------------------------+
285 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { 307 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() {
286 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 308 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
287 this, 309 this,
288 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME), 310 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME),
289 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr), 311 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr),
290 widest_name_column_view_width_); 312 widest_name_column_view_width_);
291 section->set_tag( 313 section->set_tag(
292 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON)); 314 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON));
293 return section; 315 return section;
294 } 316 }
295 317
296 // Creates the Payment Method row, which contains a "Payment" label, the user's 318 // Creates the Payment Method row, which contains a "Payment" label, the user's
(...skipping 21 matching lines...) Expand all
318 340
319 layout->StartRow(0, 0); 341 layout->StartRow(0, 0);
320 layout->AddView(new views::Label(selected_card->TypeAndLastFourDigits())); 342 layout->AddView(new views::Label(selected_card->TypeAndLastFourDigits()));
321 layout->StartRow(0, 0); 343 layout->StartRow(0, 0);
322 layout->AddView(new views::Label( 344 layout->AddView(new views::Label(
323 selected_card->GetInfo( 345 selected_card->GetInfo(
324 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), 346 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL),
325 g_browser_process->GetApplicationLocale()))); 347 g_browser_process->GetApplicationLocale())));
326 348
327 card_icon_view = base::MakeUnique<views::ImageView>(); 349 card_icon_view = base::MakeUnique<views::ImageView>();
350 card_icon_view->set_interactive(false);
328 card_icon_view->SetImage( 351 card_icon_view->SetImage(
329 ResourceBundle::GetSharedInstance() 352 ResourceBundle::GetSharedInstance()
330 .GetImageNamed(autofill::data_util::GetPaymentRequestData( 353 .GetImageNamed(autofill::data_util::GetPaymentRequestData(
331 selected_card->type()).icon_resource_id) 354 selected_card->type()).icon_resource_id)
332 .AsImageSkia()); 355 .AsImageSkia());
333 card_icon_view->SetBorder( 356 card_icon_view->SetBorder(
334 views::CreateRoundedRectBorder(1, 3, SK_ColorLTGRAY)); 357 views::CreateRoundedRectBorder(1, 3, SK_ColorLTGRAY));
335 358
336 constexpr gfx::Size kCardIconSize = gfx::Size(32, 20); 359 constexpr gfx::Size kCardIconSize = gfx::Size(32, 20);
337 card_icon_view->SetImageSize(kCardIconSize); 360 card_icon_view->SetImageSize(kCardIconSize);
338 } 361 }
339 362
340 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 363 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
341 this, 364 this,
342 l10n_util::GetStringUTF16( 365 l10n_util::GetStringUTF16(
343 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME), 366 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME),
344 std::move(content_view), 367 std::move(content_view),
345 std::move(card_icon_view), 368 std::move(card_icon_view),
346 widest_name_column_view_width_); 369 widest_name_column_view_width_);
347 section->set_tag(static_cast<int>( 370 section->set_tag(static_cast<int>(
348 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON)); 371 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON));
349 return section; 372 return section;
350 } 373 }
(...skipping 10 matching lines...) Expand all
361 384
362 // Creates the Contact Info row, which contains a "Contact info" label; the 385 // Creates the Contact Info row, which contains a "Contact info" label; the
363 // name, email address, and/or phone number; and a chevron. 386 // name, email address, and/or phone number; and a chevron.
364 // +----------------------------------------------+ 387 // +----------------------------------------------+
365 // | Contact info Barack Obama | 388 // | Contact info Barack Obama |
366 // | 1800MYPOTUS > | 389 // | 1800MYPOTUS > |
367 // | potus@whitehouse.gov | 390 // | potus@whitehouse.gov |
368 // +----------------------------------------------+ 391 // +----------------------------------------------+
369 std::unique_ptr<views::Button> 392 std::unique_ptr<views::Button>
370 PaymentSheetViewController::CreateContactInfoRow() { 393 PaymentSheetViewController::CreateContactInfoRow() {
371 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( 394 std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
372 this, 395 this,
373 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME), 396 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME),
374 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), 397 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr),
375 widest_name_column_view_width_); 398 widest_name_column_view_width_);
376 section->set_tag(static_cast<int>( 399 section->set_tag(static_cast<int>(
377 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); 400 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON));
378 return section; 401 return section;
379 } 402 }
380 403
381 } // namespace payments 404 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698