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_address_editor_view_controll
er.h" |
16 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" | 17 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
17 #include "components/constrained_window/constrained_window_views.h" | 18 #include "components/constrained_window/constrained_window_views.h" |
18 #include "components/payments/content/payment_request.h" | 19 #include "components/payments/content/payment_request.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
21 | 22 |
22 namespace chrome { | 23 namespace chrome { |
23 | 24 |
24 payments::PaymentRequestDialog* CreatePaymentRequestDialog( | 25 payments::PaymentRequestDialog* CreatePaymentRequestDialog( |
25 payments::PaymentRequest* request) { | 26 payments::PaymentRequest* request) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void PaymentRequestDialogView::ShowCreditCardEditor() { | 157 void PaymentRequestDialogView::ShowCreditCardEditor() { |
157 view_stack_.Push(CreateViewAndInstallController( | 158 view_stack_.Push(CreateViewAndInstallController( |
158 base::MakeUnique<CreditCardEditorViewController>( | 159 base::MakeUnique<CreditCardEditorViewController>( |
159 request_->spec(), request_->state(), this), | 160 request_->spec(), request_->state(), this), |
160 &controller_map_), | 161 &controller_map_), |
161 /* animate = */ true); | 162 /* animate = */ true); |
162 if (observer_for_testing_) | 163 if (observer_for_testing_) |
163 observer_for_testing_->OnCreditCardEditorOpened(); | 164 observer_for_testing_->OnCreditCardEditorOpened(); |
164 } | 165 } |
165 | 166 |
| 167 void PaymentRequestDialogView::ShowShippingAddressEditor() { |
| 168 view_stack_.Push(CreateViewAndInstallController( |
| 169 base::MakeUnique<ShippingAddressEditorViewController>( |
| 170 request_->spec(), request_->state(), this), |
| 171 &controller_map_), |
| 172 /* animate = */ true); |
| 173 if (observer_for_testing_) |
| 174 observer_for_testing_->OnShippingAddressEditorOpened(); |
| 175 } |
| 176 |
166 void PaymentRequestDialogView::ShowDialog() { | 177 void PaymentRequestDialogView::ShowDialog() { |
167 constrained_window::ShowWebModalDialogViews(this, request_->web_contents()); | 178 constrained_window::ShowWebModalDialogViews(this, request_->web_contents()); |
168 } | 179 } |
169 | 180 |
170 void PaymentRequestDialogView::CloseDialog() { | 181 void PaymentRequestDialogView::CloseDialog() { |
171 // This calls PaymentRequestDialogView::Cancel() before closing. | 182 // This calls PaymentRequestDialogView::Cancel() before closing. |
172 // ViewHierarchyChanged() also gets called after Cancel(). | 183 // ViewHierarchyChanged() also gets called after Cancel(). |
173 GetWidget()->Close(); | 184 GetWidget()->Close(); |
174 } | 185 } |
175 | 186 |
(...skipping 19 matching lines...) Expand all Loading... |
195 // When a view that is associated with a controller is removed from this | 206 // When a view that is associated with a controller is removed from this |
196 // view's descendants, dispose of the controller. | 207 // view's descendants, dispose of the controller. |
197 if (!details.is_add && | 208 if (!details.is_add && |
198 controller_map_.find(details.child) != controller_map_.end()) { | 209 controller_map_.find(details.child) != controller_map_.end()) { |
199 DCHECK(!details.move_view); | 210 DCHECK(!details.move_view); |
200 controller_map_.erase(details.child); | 211 controller_map_.erase(details.child); |
201 } | 212 } |
202 } | 213 } |
203 | 214 |
204 } // namespace payments | 215 } // namespace payments |
OLD | NEW |