| 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/credit_card_editor_view_controller.h" | 11 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" |
| 12 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" | 12 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
| 13 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" | 13 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" | 14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" | 15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
| 16 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
| 16 #include "components/constrained_window/constrained_window_views.h" | 17 #include "components/constrained_window/constrained_window_views.h" |
| 17 #include "components/payments/content/payment_request.h" | 18 #include "components/payments/content/payment_request.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "ui/views/layout/fill_layout.h" | 20 #include "ui/views/layout/fill_layout.h" |
| 20 | 21 |
| 21 namespace chrome { | 22 namespace chrome { |
| 22 | 23 |
| 23 payments::PaymentRequestDialog* CreatePaymentRequestDialog( | 24 payments::PaymentRequestDialog* CreatePaymentRequestDialog( |
| 24 payments::PaymentRequest* request) { | 25 payments::PaymentRequest* request) { |
| 25 return new payments::PaymentRequestDialogView(request, | 26 return new payments::PaymentRequestDialogView(request, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 134 |
| 134 void PaymentRequestDialogView::ShowShippingProfileSheet() { | 135 void PaymentRequestDialogView::ShowShippingProfileSheet() { |
| 135 view_stack_.Push( | 136 view_stack_.Push( |
| 136 CreateViewAndInstallController( | 137 CreateViewAndInstallController( |
| 137 ProfileListViewController::GetShippingProfileViewController(request_, | 138 ProfileListViewController::GetShippingProfileViewController(request_, |
| 138 this), | 139 this), |
| 139 &controller_map_), | 140 &controller_map_), |
| 140 /* animate = */ true); | 141 /* animate = */ true); |
| 141 } | 142 } |
| 142 | 143 |
| 144 void PaymentRequestDialogView::ShowShippingOptionSheet() { |
| 145 view_stack_.Push( |
| 146 CreateViewAndInstallController( |
| 147 base::MakeUnique<ShippingOptionViewController>(request_, this), |
| 148 &controller_map_), |
| 149 /* animate = */ true); |
| 150 } |
| 151 |
| 143 void PaymentRequestDialogView::ShowCreditCardEditor() { | 152 void PaymentRequestDialogView::ShowCreditCardEditor() { |
| 144 view_stack_.Push( | 153 view_stack_.Push( |
| 145 CreateViewAndInstallController( | 154 CreateViewAndInstallController( |
| 146 base::MakeUnique<CreditCardEditorViewController>(request_, this), | 155 base::MakeUnique<CreditCardEditorViewController>(request_, this), |
| 147 &controller_map_), | 156 &controller_map_), |
| 148 /* animate = */ true); | 157 /* animate = */ true); |
| 149 if (observer_for_testing_) | 158 if (observer_for_testing_) |
| 150 observer_for_testing_->OnCreditCardEditorOpened(); | 159 observer_for_testing_->OnCreditCardEditorOpened(); |
| 151 } | 160 } |
| 152 | 161 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 182 // When a view that is associated with a controller is removed from this | 191 // When a view that is associated with a controller is removed from this |
| 183 // view's descendants, dispose of the controller. | 192 // view's descendants, dispose of the controller. |
| 184 if (!details.is_add && | 193 if (!details.is_add && |
| 185 controller_map_.find(details.child) != controller_map_.end()) { | 194 controller_map_.find(details.child) != controller_map_.end()) { |
| 186 DCHECK(!details.move_view); | 195 DCHECK(!details.move_view); |
| 187 controller_map_.erase(details.child); | 196 controller_map_.erase(details.child); |
| 188 } | 197 } |
| 189 } | 198 } |
| 190 | 199 |
| 191 } // namespace payments | 200 } // namespace payments |
| OLD | NEW |