| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // Creates the Shipping row, which contains a "Shipping address" label, the | 407 // Creates the Shipping row, which contains a "Shipping address" label, the |
| 408 // user's selected shipping address, and a chevron. | 408 // user's selected shipping address, and a chevron. |
| 409 // +----------------------------------------------+ | 409 // +----------------------------------------------+ |
| 410 // | Shipping Address Barack Obama | | 410 // | Shipping Address Barack Obama | |
| 411 // | 1600 Pennsylvania Ave. > | | 411 // | 1600 Pennsylvania Ave. > | |
| 412 // | 1800MYPOTUS | | 412 // | 1800MYPOTUS | |
| 413 // +----------------------------------------------+ | 413 // +----------------------------------------------+ |
| 414 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { | 414 std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { |
| 415 std::unique_ptr<views::Button> section = CreatePaymentSheetRow( | 415 std::unique_ptr<views::Button> section = CreatePaymentSheetRow( |
| 416 this, | 416 this, |
| 417 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME), | 417 GetShippingAddressSectionString(request()->options()->shipping_type), |
| 418 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr), | 418 CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 419 widest_name_column_view_width_); | 419 widest_name_column_view_width_); |
| 420 section->set_tag( | 420 section->set_tag( |
| 421 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON)); | 421 static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON)); |
| 422 section->set_id( | 422 section->set_id( |
| 423 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_SECTION)); | 423 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_SECTION)); |
| 424 return section; | 424 return section; |
| 425 } | 425 } |
| 426 | 426 |
| 427 // Creates the Payment Method row, which contains a "Payment" label, the user's | 427 // Creates the Payment Method row, which contains a "Payment" label, the user's |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 container->AddChildView( | 521 container->AddChildView( |
| 522 new views::Label(request()->GetFormattedCurrencyAmount( | 522 new views::Label(request()->GetFormattedCurrencyAmount( |
| 523 selected_shipping_option->amount->value))); | 523 selected_shipping_option->amount->value))); |
| 524 } | 524 } |
| 525 | 525 |
| 526 return container; | 526 return container; |
| 527 } | 527 } |
| 528 | 528 |
| 529 std::unique_ptr<views::Button> | 529 std::unique_ptr<views::Button> |
| 530 PaymentSheetViewController::CreateShippingOptionRow() { | 530 PaymentSheetViewController::CreateShippingOptionRow() { |
| 531 // TODO(anthonyvd): Use the correct IDS_PAYMENTS_*_OPTION_LABEL string based | |
| 532 // on the data passed by the website. | |
| 533 std::unique_ptr<views::Button> section = CreatePaymentSheetRow( | 531 std::unique_ptr<views::Button> section = CreatePaymentSheetRow( |
| 534 this, l10n_util::GetStringUTF16(IDS_PAYMENTS_SHIPPING_OPTION_LABEL), | 532 this, GetShippingOptionSectionString(request()->options()->shipping_type), |
| 535 CreateShippingOptionContent(), std::unique_ptr<views::View>(nullptr), | 533 CreateShippingOptionContent(), std::unique_ptr<views::View>(nullptr), |
| 536 widest_name_column_view_width_); | 534 widest_name_column_view_width_); |
| 537 section->set_tag(static_cast<int>( | 535 section->set_tag(static_cast<int>( |
| 538 PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON)); | 536 PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON)); |
| 539 section->set_id( | 537 section->set_id( |
| 540 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION)); | 538 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION)); |
| 541 return section; | 539 return section; |
| 542 } | 540 } |
| 543 | 541 |
| 544 } // namespace payments | 542 } // namespace payments |
| OLD | NEW |