| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 CreateSheetHeaderView( | 197 CreateSheetHeaderView( |
| 198 false, | 198 false, |
| 199 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), | 199 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), |
| 200 this), | 200 this), |
| 201 std::move(content_view)); | 201 std::move(content_view)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void PaymentSheetViewController::ButtonPressed( | 204 void PaymentSheetViewController::ButtonPressed( |
| 205 views::Button* sender, const ui::Event& event) { | 205 views::Button* sender, const ui::Event& event) { |
| 206 switch (sender->tag()) { | 206 switch (sender->tag()) { |
| 207 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): | |
| 208 dialog()->CloseDialog(); | |
| 209 break; | |
| 210 | |
| 211 case static_cast<int>( | 207 case static_cast<int>( |
| 212 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): | 208 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): |
| 213 dialog()->ShowOrderSummary(); | 209 dialog()->ShowOrderSummary(); |
| 214 break; | 210 break; |
| 215 | 211 |
| 216 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): | 212 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): |
| 217 dialog()->ShowShippingListSheet(); | 213 dialog()->ShowShippingListSheet(); |
| 218 break; | 214 break; |
| 219 | 215 |
| 220 case static_cast<int>( | 216 case static_cast<int>( |
| 221 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): | 217 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): |
| 222 dialog()->ShowPaymentMethodSheet(); | 218 dialog()->ShowPaymentMethodSheet(); |
| 223 break; | 219 break; |
| 224 | 220 |
| 225 case static_cast<int>( | 221 case static_cast<int>( |
| 226 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): | 222 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): |
| 227 // TODO(tmartino): Transition to contact info page once it exists. | 223 // TODO(tmartino): Transition to contact info page once it exists. |
| 228 break; | 224 break; |
| 229 | 225 |
| 230 default: | 226 default: |
| 231 NOTREACHED(); | 227 PaymentRequestSheetController::ButtonPressed(sender, event); |
| 228 break; |
| 232 } | 229 } |
| 233 } | 230 } |
| 234 | 231 |
| 235 std::unique_ptr<views::View> | 232 std::unique_ptr<views::View> |
| 236 PaymentSheetViewController::CreateOrderSummarySectionContent() { | 233 PaymentSheetViewController::CreateOrderSummarySectionContent() { |
| 237 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( | 234 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( |
| 238 request()->details()->total->amount->currency, | 235 request()->details()->total->amount->currency, |
| 239 request()->details()->total->amount->currency_system, | 236 request()->details()->total->amount->currency_system, |
| 240 g_browser_process->GetApplicationLocale()); | 237 g_browser_process->GetApplicationLocale()); |
| 241 base::string16 label_value = l10n_util::GetStringFUTF16( | 238 base::string16 label_value = l10n_util::GetStringFUTF16( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), | 379 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 383 widest_name_column_view_width_); | 380 widest_name_column_view_width_); |
| 384 section->set_tag(static_cast<int>( | 381 section->set_tag(static_cast<int>( |
| 385 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); | 382 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); |
| 386 section->set_id( | 383 section->set_id( |
| 387 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); | 384 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); |
| 388 return section; | 385 return section; |
| 389 } | 386 } |
| 390 | 387 |
| 391 } // namespace payments | 388 } // namespace payments |
| OLD | NEW |