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

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

Issue 2847503002: [WebPayments] Show labels on incomplete profiles (Closed)
Patch Set: ios namespace 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 591 }
592 592
593 std::unique_ptr<views::View> 593 std::unique_ptr<views::View>
594 PaymentSheetViewController::CreateShippingSectionContent() { 594 PaymentSheetViewController::CreateShippingSectionContent() {
595 if (current_update_reason_ == 595 if (current_update_reason_ ==
596 PaymentRequestSpec::UpdateReason::SHIPPING_ADDRESS) { 596 PaymentRequestSpec::UpdateReason::SHIPPING_ADDRESS) {
597 return CreateCheckingSpinnerView(); 597 return CreateCheckingSpinnerView();
598 } else { 598 } else {
599 auto* profile = state()->selected_shipping_profile(); 599 auto* profile = state()->selected_shipping_profile();
600 600
601 return profile ? GetShippingAddressLabel(AddressStyleType::SUMMARY, 601 return profile
602 state()->GetApplicationLocale(), 602 ? GetShippingAddressLabel(
603 *profile) 603 AddressStyleType::SUMMARY, state()->GetApplicationLocale(),
604 : base::MakeUnique<views::Label>(base::string16()); 604 *profile, *spec(), *(state()->profile_comparator()))
605 : base::MakeUnique<views::Label>(base::string16());
605 } 606 }
606 } 607 }
607 608
608 // Creates the Shipping row, which contains a "Shipping address" label, the 609 // Creates the Shipping row, which contains a "Shipping address" label, the
609 // user's selected shipping address, and a chevron. 610 // user's selected shipping address, and a chevron.
610 // +----------------------------------------------+ 611 // +----------------------------------------------+
611 // | Shipping Address Barack Obama | 612 // | Shipping Address Barack Obama |
612 // | 1600 Pennsylvania Ave. > | 613 // | 1600 Pennsylvania Ave. > |
613 // | 1800MYPOTUS | 614 // | 1800MYPOTUS |
614 // +----------------------------------------------+ 615 // +----------------------------------------------+
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 state()->available_instruments()[0]->label(), format, 721 state()->available_instruments()[0]->label(), format,
721 state()->available_instruments().size() - 1, button_string, 722 state()->available_instruments().size() - 1, button_string,
722 /*button_enabled=*/true); 723 /*button_enabled=*/true);
723 } 724 }
724 } 725 }
725 } 726 }
726 727
727 std::unique_ptr<views::View> 728 std::unique_ptr<views::View>
728 PaymentSheetViewController::CreateContactInfoSectionContent() { 729 PaymentSheetViewController::CreateContactInfoSectionContent() {
729 autofill::AutofillProfile* profile = state()->selected_contact_profile(); 730 autofill::AutofillProfile* profile = state()->selected_contact_profile();
730 return profile ? payments::GetContactInfoLabel( 731 return profile
731 AddressStyleType::SUMMARY, 732 ? payments::GetContactInfoLabel(
732 state()->GetApplicationLocale(), *profile, *spec()) 733 AddressStyleType::SUMMARY, state()->GetApplicationLocale(),
733 : base::MakeUnique<views::Label>(base::string16()); 734 *profile, *spec(), *(state()->profile_comparator()))
735 : base::MakeUnique<views::Label>(base::string16());
734 } 736 }
735 737
736 // Creates the Contact Info row, which contains a "Contact info" label; the 738 // Creates the Contact Info row, which contains a "Contact info" label; the
737 // name, email address, and/or phone number; and a chevron. 739 // name, email address, and/or phone number; and a chevron.
738 // +----------------------------------------------+ 740 // +----------------------------------------------+
739 // | Contact info Barack Obama | 741 // | Contact info Barack Obama |
740 // | 1800MYPOTUS > | 742 // | 1800MYPOTUS > |
741 // | potus@whitehouse.gov | 743 // | potus@whitehouse.gov |
742 // +----------------------------------------------+ 744 // +----------------------------------------------+
743 std::unique_ptr<views::Button> 745 std::unique_ptr<views::Button>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 } else { 847 } else {
846 return builder 848 return builder
847 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON) 849 .Id(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON)
848 .CreateWithButton( 850 .CreateWithButton(
849 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS), 851 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CHOOSE_AN_ADDRESS),
850 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false); 852 l10n_util::GetStringUTF16(IDS_CHOOSE), /*button_enabled=*/false);
851 } 853 }
852 } 854 }
853 855
854 } // namespace payments 856 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698