Chromium Code Reviews| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 layout->StartRow(0, 0); | 191 layout->StartRow(0, 0); |
| 192 layout->AddView(CreatePaymentMethodRow().release()); | 192 layout->AddView(CreatePaymentMethodRow().release()); |
| 193 layout->StartRow(1, 0); | 193 layout->StartRow(1, 0); |
| 194 layout->AddView(CreateContactInfoRow().release()); | 194 layout->AddView(CreateContactInfoRow().release()); |
| 195 | 195 |
| 196 return CreatePaymentView( | 196 return CreatePaymentView( |
| 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 CreateButtonsView(this)); | |
|
Mathieu
2017/01/31 22:53:12
Perhaps CreateButtonsView could be part of CreateP
anthonyvd
2017/02/01 15:35:23
Many of the screens in the mocks have extra/differ
Mathieu
2017/02/01 17:17:36
Wow, I didn't realize that there were so many butt
| |
| 202 } | 203 } |
| 203 | 204 |
| 204 void PaymentSheetViewController::ButtonPressed( | 205 void PaymentSheetViewController::ButtonPressed( |
| 205 views::Button* sender, const ui::Event& event) { | 206 views::Button* sender, const ui::Event& event) { |
| 206 switch (sender->tag()) { | 207 switch (sender->tag()) { |
| 207 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): | |
| 208 dialog()->CloseDialog(); | |
| 209 break; | |
| 210 | |
| 211 case static_cast<int>( | 208 case static_cast<int>( |
| 212 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): | 209 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON): |
| 213 dialog()->ShowOrderSummary(); | 210 dialog()->ShowOrderSummary(); |
| 214 break; | 211 break; |
| 215 | 212 |
| 216 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): | 213 case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON): |
| 217 dialog()->ShowShippingListSheet(); | 214 dialog()->ShowShippingListSheet(); |
| 218 break; | 215 break; |
| 219 | 216 |
| 220 case static_cast<int>( | 217 case static_cast<int>( |
| 221 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): | 218 PaymentSheetViewControllerTags::SHOW_PAYMENT_METHOD_BUTTON): |
| 222 dialog()->ShowPaymentMethodSheet(); | 219 dialog()->ShowPaymentMethodSheet(); |
| 223 break; | 220 break; |
| 224 | 221 |
| 225 case static_cast<int>( | 222 case static_cast<int>( |
| 226 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): | 223 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON): |
| 227 // TODO(tmartino): Transition to contact info page once it exists. | 224 // TODO(tmartino): Transition to contact info page once it exists. |
| 228 break; | 225 break; |
| 229 | 226 |
| 230 default: | 227 default: |
| 231 NOTREACHED(); | 228 PaymentRequestSheetController::ButtonPressed(sender, event); |
| 229 break; | |
| 232 } | 230 } |
| 233 } | 231 } |
| 234 | 232 |
| 235 std::unique_ptr<views::View> | 233 std::unique_ptr<views::View> |
| 236 PaymentSheetViewController::CreateOrderSummarySectionContent() { | 234 PaymentSheetViewController::CreateOrderSummarySectionContent() { |
| 237 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( | 235 CurrencyFormatter* formatter = request()->GetOrCreateCurrencyFormatter( |
| 238 request()->details()->total->amount->currency, | 236 request()->details()->total->amount->currency, |
| 239 request()->details()->total->amount->currency_system, | 237 request()->details()->total->amount->currency_system, |
| 240 g_browser_process->GetApplicationLocale()); | 238 g_browser_process->GetApplicationLocale()); |
| 241 base::string16 label_value = l10n_util::GetStringFUTF16( | 239 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), | 380 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 383 widest_name_column_view_width_); | 381 widest_name_column_view_width_); |
| 384 section->set_tag(static_cast<int>( | 382 section->set_tag(static_cast<int>( |
| 385 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); | 383 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); |
| 386 section->set_id( | 384 section->set_id( |
| 387 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); | 385 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); |
| 388 return section; | 386 return section; |
| 389 } | 387 } |
| 390 | 388 |
| 391 } // namespace payments | 389 } // namespace payments |
| OLD | NEW |