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

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

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: Merge branch 'master' into billing Created 3 years, 7 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 <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Tags for the buttons in the payment sheet 58 // Tags for the buttons in the payment sheet
59 enum class PaymentSheetViewControllerTags { 59 enum class PaymentSheetViewControllerTags {
60 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue, // Navigate to order summary 60 SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue, // Navigate to order summary
61 SHOW_SHIPPING_BUTTON, // Navigate to the shipping address screen 61 SHOW_SHIPPING_BUTTON, // Navigate to the shipping address screen
62 ADD_SHIPPING_BUTTON, // Navigate to the shipping address editor 62 ADD_SHIPPING_BUTTON, // Navigate to the shipping address editor
63 SHOW_PAYMENT_METHOD_BUTTON, // Navigate to the payment method screen 63 SHOW_PAYMENT_METHOD_BUTTON, // Navigate to the payment method screen
64 ADD_PAYMENT_METHOD_BUTTON, // Navigate to the payment method editor 64 ADD_PAYMENT_METHOD_BUTTON, // Navigate to the payment method editor
65 SHOW_CONTACT_INFO_BUTTON, // Navigate to the contact info screen 65 SHOW_CONTACT_INFO_BUTTON, // Navigate to the contact info screen
66 ADD_CONTACT_INFO_BUTTON, // Navigate to the contact info editor 66 ADD_CONTACT_INFO_BUTTON, // Navigate to the contact info editor
67 SHOW_SHIPPING_OPTION_BUTTON, // Navigate to the shipping options screen 67 SHOW_SHIPPING_OPTION_BUTTON, // Navigate to the shipping options screen
68 PAY_BUTTON 68 PAY_BUTTON,
69 MAX_TAG, // Always keep last.
69 }; 70 };
70 71
71 // A class that ensures proper elision of labels in the form 72 // A class that ensures proper elision of labels in the form
72 // "[preview] and N more" where preview might be elided to allow "and N more" to 73 // "[preview] and N more" where preview might be elided to allow "and N more" to
73 // be always visible. 74 // be always visible.
74 class PreviewEliderLabel : public views::Label { 75 class PreviewEliderLabel : public views::Label {
75 public: 76 public:
76 // Creates a PreviewEliderLabel where |preview_text| might be elided, 77 // Creates a PreviewEliderLabel where |preview_text| might be elided,
77 // |format_string| is the string with format argument numbers in ICU syntax 78 // |format_string| is the string with format argument numbers in ICU syntax
78 // and |n| is the "N more" item count. 79 // and |n| is the "N more" item count.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): 479 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON):
479 dialog()->ShowOrderSummary(); 480 dialog()->ShowOrderSummary();
480 break; 481 break;
481 482
482 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): 483 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON):
483 dialog()->ShowShippingProfileSheet(); 484 dialog()->ShowShippingProfileSheet();
484 break; 485 break;
485 486
486 case static_cast<int>(PaymentSheetViewControllerTags::ADD_SHIPPING_BUTTON): 487 case static_cast<int>(PaymentSheetViewControllerTags::ADD_SHIPPING_BUTTON):
487 dialog()->ShowShippingAddressEditor( 488 dialog()->ShowShippingAddressEditor(
489 BackNavigationType::kPaymentSheet,
488 /*on_edited=*/base::OnceClosure(), // This is always an add. 490 /*on_edited=*/base::OnceClosure(), // This is always an add.
489 /*on_added=*/ 491 /*on_added=*/
490 base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile, 492 base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile,
491 base::Unretained(state()), /*selected=*/true), 493 base::Unretained(state()), /*selected=*/true),
492 nullptr); 494 nullptr);
493 break; 495 break;
494 496
495 case static_cast<int>( 497 case static_cast<int>(
496 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): 498 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON):
497 dialog()->ShowPaymentMethodSheet(); 499 dialog()->ShowPaymentMethodSheet();
498 break; 500 break;
499 501
500 case static_cast<int>( 502 case static_cast<int>(
501 PaymentSheetViewControllerTags::ADD_PAYMENT_METHOD_BUTTON): 503 PaymentSheetViewControllerTags::ADD_PAYMENT_METHOD_BUTTON):
502 dialog()->ShowCreditCardEditor( 504 dialog()->ShowCreditCardEditor(
505 BackNavigationType::kPaymentSheet,
506 static_cast<int>(PaymentSheetViewControllerTags::MAX_TAG),
503 /*on_edited=*/base::OnceClosure(), // This is always an add. 507 /*on_edited=*/base::OnceClosure(), // This is always an add.
504 /*on_added=*/ 508 /*on_added=*/
505 base::BindOnce(&PaymentRequestState::AddAutofillPaymentInstrument, 509 base::BindOnce(&PaymentRequestState::AddAutofillPaymentInstrument,
506 base::Unretained(state()), /*selected=*/true), 510 base::Unretained(state()), /*selected=*/true),
507 /*credit_card=*/nullptr); 511 /*credit_card=*/nullptr);
508 512
509 break; 513 break;
510 514
511 case static_cast<int>( 515 case static_cast<int>(
512 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): 516 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON):
513 dialog()->ShowContactProfileSheet(); 517 dialog()->ShowContactProfileSheet();
514 break; 518 break;
515 519
516 case static_cast<int>( 520 case static_cast<int>(
517 PaymentSheetViewControllerTags::ADD_CONTACT_INFO_BUTTON): 521 PaymentSheetViewControllerTags::ADD_CONTACT_INFO_BUTTON):
518 dialog()->ShowContactInfoEditor(); 522 dialog()->ShowContactInfoEditor(BackNavigationType::kPaymentSheet);
519 break; 523 break;
520 524
521 case static_cast<int>( 525 case static_cast<int>(
522 PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON): 526 PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON):
523 dialog()->ShowShippingOptionSheet(); 527 dialog()->ShowShippingOptionSheet();
524 break; 528 break;
525 529
526 default: 530 default:
527 PaymentRequestSheetController::ButtonPressed(sender, event); 531 PaymentRequestSheetController::ButtonPressed(sender, event);
528 break; 532 break;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } else { 892 } else {
889 return builder 893 return builder
890 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON) 894 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON)
891 .CreateWithButton( 895 .CreateWithButton(
892 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS), 896 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS),
893 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false); 897 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false);
894 } 898 }
895 } 899 }
896 900
897 } // namespace payments 901 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698