| OLD | NEW |
| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 615 |
| 616 return builder.CreateWithChevron(std::move(inline_summary), nullptr); | 616 return builder.CreateWithChevron(std::move(inline_summary), nullptr); |
| 617 } | 617 } |
| 618 | 618 |
| 619 std::unique_ptr<views::View> | 619 std::unique_ptr<views::View> |
| 620 PaymentSheetViewController::CreateShippingSectionContent() { | 620 PaymentSheetViewController::CreateShippingSectionContent() { |
| 621 autofill::AutofillProfile* profile = state()->selected_shipping_profile(); | 621 autofill::AutofillProfile* profile = state()->selected_shipping_profile(); |
| 622 if (!profile) | 622 if (!profile) |
| 623 return base::MakeUnique<views::Label>(base::string16()); | 623 return base::MakeUnique<views::Label>(base::string16()); |
| 624 | 624 |
| 625 // If there is a shipping option error related to the selected address, | 625 return GetShippingAddressLabelWithMissingInfo( |
| 626 // display it (without disabling the row because the user should feel like | 626 AddressStyleType::SUMMARY, state()->GetApplicationLocale(), *profile, |
| 627 // they can click on it to correct the problem). Otherwise, display the | 627 *(state()->profile_comparator())); |
| 628 // address possibly with the missing information to make it complete. | |
| 629 if (!spec()->selected_shipping_option_error().empty()) { | |
| 630 return GetShippingAddressLabelWithError( | |
| 631 AddressStyleType::SUMMARY, state()->GetApplicationLocale(), *profile, | |
| 632 spec()->selected_shipping_option_error(), /*disabled_state=*/false); | |
| 633 } else { | |
| 634 return GetShippingAddressLabelWithMissingInfo( | |
| 635 AddressStyleType::SUMMARY, state()->GetApplicationLocale(), *profile, | |
| 636 *(state()->profile_comparator())); | |
| 637 } | |
| 638 } | 628 } |
| 639 | 629 |
| 640 // Creates the Shipping row, which contains a "Shipping address" label, the | 630 // Creates the Shipping row, which contains a "Shipping address" label, the |
| 641 // user's selected shipping address, and a chevron. | 631 // user's selected shipping address, and a chevron. |
| 642 // +----------------------------------------------+ | 632 // +----------------------------------------------+ |
| 643 // | Shipping Address Barack Obama | | 633 // | Shipping Address Barack Obama | |
| 644 // | 1600 Pennsylvania Ave. > | | 634 // | 1600 Pennsylvania Ave. > | |
| 645 // | 1800MYPOTUS | | 635 // | 1800MYPOTUS | |
| 646 // +----------------------------------------------+ | 636 // +----------------------------------------------+ |
| 647 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { | 637 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 data_source_label->SetDefaultStyle(default_style); | 919 data_source_label->SetDefaultStyle(default_style); |
| 930 data_source_label->AddStyleRange( | 920 data_source_label->AddStyleRange( |
| 931 gfx::Range(link_begin, link_begin + link_length), | 921 gfx::Range(link_begin, link_begin + link_length), |
| 932 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 922 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 933 data_source_label->SizeToFit(0); | 923 data_source_label->SizeToFit(0); |
| 934 content_view->AddChildView(data_source_label.release()); | 924 content_view->AddChildView(data_source_label.release()); |
| 935 return content_view; | 925 return content_view; |
| 936 } | 926 } |
| 937 | 927 |
| 938 } // namespace payments | 928 } // namespace payments |
| OLD | NEW |