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

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

Powered by Google App Engine
This is Rietveld 408576698