| 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 <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): | 206 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): |
| 207 dialog()->CloseDialog(); | 207 dialog()->CloseDialog(); |
| 208 break; | 208 break; |
| 209 | 209 |
| 210 case static_cast<int>( | 210 case static_cast<int>( |
| 211 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): | 211 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): |
| 212 dialog()->ShowOrderSummary(); | 212 dialog()->ShowOrderSummary(); |
| 213 break; | 213 break; |
| 214 | 214 |
| 215 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): | 215 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): |
| 216 // TODO(tmartino): Transition to shipping page once it exists. | 216 dialog()->ShowShippingListSheet(); |
| 217 break; | 217 break; |
| 218 | 218 |
| 219 case static_cast<int>( | 219 case static_cast<int>( |
| 220 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): | 220 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): |
| 221 dialog()->ShowPaymentMethodSheet(); | 221 dialog()->ShowPaymentMethodSheet(); |
| 222 break; | 222 break; |
| 223 | 223 |
| 224 case static_cast<int>( | 224 case static_cast<int>( |
| 225 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): | 225 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): |
| 226 // TODO(tmartino): Transition to contact info page once it exists. | 226 // TODO(tmartino): Transition to contact info page once it exists. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 std::unique_ptr<views::View>(nullptr), | 259 std::unique_ptr<views::View>(nullptr), |
| 260 CreateOrderSummarySectionContent(), | 260 CreateOrderSummarySectionContent(), |
| 261 widest_name_column_view_width_); | 261 widest_name_column_view_width_); |
| 262 section->set_tag(static_cast<int>( | 262 section->set_tag(static_cast<int>( |
| 263 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); | 263 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); |
| 264 return section; | 264 return section; |
| 265 } | 265 } |
| 266 | 266 |
| 267 std::unique_ptr<views::View> | 267 std::unique_ptr<views::View> |
| 268 PaymentSheetViewController::CreateShippingSectionContent() { | 268 PaymentSheetViewController::CreateShippingSectionContent() { |
| 269 auto profile = request()->GetCurrentlySelectedProfile(); | 269 auto profile = request()->selected_shipping_profile(); |
| 270 | 270 |
| 271 // TODO(tmartino): Empty string param is app locale; this should be passed | 271 // 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. | 272 // at construct-time and stored as a member in a future CL. |
| 273 return profile ? payments::GetShippingAddressLabel(AddressStyleType::SUMMARY, | 273 return profile ? payments::GetShippingAddressLabel(AddressStyleType::SUMMARY, |
| 274 std::string(), *profile) | 274 std::string(), *profile) |
| 275 : base::MakeUnique<views::Label>(base::string16()); | 275 : base::MakeUnique<views::Label>(base::string16()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Creates the Shipping row, which contains a "Shipping address" label, the | 278 // Creates the Shipping row, which contains a "Shipping address" label, the |
| 279 // user's selected shipping address, and a chevron. | 279 // user's selected shipping address, and a chevron. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 std::move(content_view), | 344 std::move(content_view), |
| 345 std::move(card_icon_view), | 345 std::move(card_icon_view), |
| 346 widest_name_column_view_width_); | 346 widest_name_column_view_width_); |
| 347 section->set_tag(static_cast<int>( | 347 section->set_tag(static_cast<int>( |
| 348 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON)); | 348 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON)); |
| 349 return section; | 349 return section; |
| 350 } | 350 } |
| 351 | 351 |
| 352 std::unique_ptr<views::View> | 352 std::unique_ptr<views::View> |
| 353 PaymentSheetViewController::CreateContactInfoSectionContent() { | 353 PaymentSheetViewController::CreateContactInfoSectionContent() { |
| 354 auto profile = request()->GetCurrentlySelectedProfile(); | 354 auto profile = request()->selected_contact_profile(); |
| 355 // TODO(tmartino): Replace empty string with app locale. | 355 // TODO(tmartino): Replace empty string with app locale. |
| 356 return profile ? payments::GetContactInfoLabel(AddressStyleType::SUMMARY, | 356 return profile ? payments::GetContactInfoLabel(AddressStyleType::SUMMARY, |
| 357 std::string(), *profile, true, | 357 std::string(), *profile, true, |
| 358 true, true) | 358 true, true) |
| 359 : base::MakeUnique<views::Label>(base::string16()); | 359 : base::MakeUnique<views::Label>(base::string16()); |
| 360 } | 360 } |
| 361 | 361 |
| 362 // Creates the Contact Info row, which contains a "Contact info" label; the | 362 // Creates the Contact Info row, which contains a "Contact info" label; the |
| 363 // name, email address, and/or phone number; and a chevron. | 363 // name, email address, and/or phone number; and a chevron. |
| 364 // +----------------------------------------------+ | 364 // +----------------------------------------------+ |
| 365 // | Contact info Barack Obama | | 365 // | Contact info Barack Obama | |
| 366 // | 1800MYPOTUS > | | 366 // | 1800MYPOTUS > | |
| 367 // | potus@whitehouse.gov | | 367 // | potus@whitehouse.gov | |
| 368 // +----------------------------------------------+ | 368 // +----------------------------------------------+ |
| 369 std::unique_ptr<views::Button> | 369 std::unique_ptr<views::Button> |
| 370 PaymentSheetViewController::CreateContactInfoRow() { | 370 PaymentSheetViewController::CreateContactInfoRow() { |
| 371 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( | 371 std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>( |
| 372 this, | 372 this, |
| 373 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME), | 373 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME), |
| 374 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), | 374 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 375 widest_name_column_view_width_); | 375 widest_name_column_view_width_); |
| 376 section->set_tag(static_cast<int>( | 376 section->set_tag(static_cast<int>( |
| 377 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); | 377 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); |
| 378 return section; | 378 return section; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace payments | 381 } // namespace payments |
| OLD | NEW |