| 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_request_dialog_view.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/ui/views/payments/contact_info_view_controller.h" | |
| 12 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" | 11 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" |
| 13 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" | 12 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" | 13 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" |
| 15 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" | 14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 16 #include "chrome/browser/ui/views/payments/shipping_list_view_controller.h" | 15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
| 17 #include "components/constrained_window/constrained_window_views.h" | 16 #include "components/constrained_window/constrained_window_views.h" |
| 18 #include "components/payments/content/payment_request.h" | 17 #include "components/payments/content/payment_request.h" |
| 19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 20 #include "ui/views/layout/fill_layout.h" | 19 #include "ui/views/layout/fill_layout.h" |
| 21 | 20 |
| 22 namespace chrome { | 21 namespace chrome { |
| 23 | 22 |
| 24 payments::PaymentRequestDialog* CreatePaymentRequestDialog( | 23 payments::PaymentRequestDialog* CreatePaymentRequestDialog( |
| 25 payments::PaymentRequest* request) { | 24 payments::PaymentRequest* request) { |
| 26 return new payments::PaymentRequestDialogView(request, | 25 return new payments::PaymentRequestDialogView(request, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return ui::DIALOG_BUTTON_NONE; | 93 return ui::DIALOG_BUTTON_NONE; |
| 95 } | 94 } |
| 96 | 95 |
| 97 void PaymentRequestDialogView::GoBack() { | 96 void PaymentRequestDialogView::GoBack() { |
| 98 view_stack_.Pop(); | 97 view_stack_.Pop(); |
| 99 | 98 |
| 100 if (observer_for_testing_) | 99 if (observer_for_testing_) |
| 101 observer_for_testing_->OnBackNavigation(); | 100 observer_for_testing_->OnBackNavigation(); |
| 102 } | 101 } |
| 103 | 102 |
| 104 void PaymentRequestDialogView::ShowContactInfoSheet() { | 103 void PaymentRequestDialogView::ShowContactProfileSheet() { |
| 105 view_stack_.Push( | 104 view_stack_.Push( |
| 106 CreateViewAndInstallController( | 105 CreateViewAndInstallController( |
| 107 base::MakeUnique<ContactInfoViewController>(request_, this), | 106 ProfileListViewController::GetContactProfileViewController(request_, |
| 107 this), |
| 108 &controller_map_), | 108 &controller_map_), |
| 109 /* animate */ true); | 109 /* animate */ true); |
| 110 if (observer_for_testing_) | 110 if (observer_for_testing_) |
| 111 observer_for_testing_->OnContactInfoOpened(); | 111 observer_for_testing_->OnContactInfoOpened(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void PaymentRequestDialogView::ShowOrderSummary() { | 114 void PaymentRequestDialogView::ShowOrderSummary() { |
| 115 view_stack_.Push( | 115 view_stack_.Push( |
| 116 CreateViewAndInstallController( | 116 CreateViewAndInstallController( |
| 117 base::MakeUnique<OrderSummaryViewController>(request_, this), | 117 base::MakeUnique<OrderSummaryViewController>(request_, this), |
| 118 &controller_map_), | 118 &controller_map_), |
| 119 /* animate = */ true); | 119 /* animate = */ true); |
| 120 if (observer_for_testing_) | 120 if (observer_for_testing_) |
| 121 observer_for_testing_->OnOrderSummaryOpened(); | 121 observer_for_testing_->OnOrderSummaryOpened(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void PaymentRequestDialogView::ShowPaymentMethodSheet() { | 124 void PaymentRequestDialogView::ShowPaymentMethodSheet() { |
| 125 view_stack_.Push( | 125 view_stack_.Push( |
| 126 CreateViewAndInstallController( | 126 CreateViewAndInstallController( |
| 127 base::MakeUnique<PaymentMethodViewController>(request_, this), | 127 base::MakeUnique<PaymentMethodViewController>(request_, this), |
| 128 &controller_map_), | 128 &controller_map_), |
| 129 /* animate = */ true); | 129 /* animate = */ true); |
| 130 if (observer_for_testing_) | 130 if (observer_for_testing_) |
| 131 observer_for_testing_->OnPaymentMethodOpened(); | 131 observer_for_testing_->OnPaymentMethodOpened(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void PaymentRequestDialogView::ShowShippingListSheet() { | 134 void PaymentRequestDialogView::ShowShippingProfileSheet() { |
| 135 view_stack_.Push( | 135 view_stack_.Push( |
| 136 CreateViewAndInstallController( | 136 CreateViewAndInstallController( |
| 137 base::MakeUnique<ShippingListViewController>(request_, this), | 137 ProfileListViewController::GetShippingProfileViewController(request_, |
| 138 this), |
| 138 &controller_map_), | 139 &controller_map_), |
| 139 /* animate = */ true); | 140 /* animate = */ true); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void PaymentRequestDialogView::ShowCreditCardEditor() { | 143 void PaymentRequestDialogView::ShowCreditCardEditor() { |
| 143 view_stack_.Push( | 144 view_stack_.Push( |
| 144 CreateViewAndInstallController( | 145 CreateViewAndInstallController( |
| 145 base::MakeUnique<CreditCardEditorViewController>(request_, this), | 146 base::MakeUnique<CreditCardEditorViewController>(request_, this), |
| 146 &controller_map_), | 147 &controller_map_), |
| 147 /* animate = */ true); | 148 /* animate = */ true); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // When a view that is associated with a controller is removed from this | 182 // When a view that is associated with a controller is removed from this |
| 182 // view's descendants, dispose of the controller. | 183 // view's descendants, dispose of the controller. |
| 183 if (!details.is_add && | 184 if (!details.is_add && |
| 184 controller_map_.find(details.child) != controller_map_.end()) { | 185 controller_map_.find(details.child) != controller_map_.end()) { |
| 185 DCHECK(!details.move_view); | 186 DCHECK(!details.move_view); |
| 186 controller_map_.erase(details.child); | 187 controller_map_.erase(details.child); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace payments | 191 } // namespace payments |
| OLD | NEW |