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/cvc_unmask_view_controller.h" | 12 #include "chrome/browser/ui/views/payments/cvc_unmask_view_controller.h" |
13 #include "chrome/browser/ui/views/payments/error_message_view_controller.h" | 13 #include "chrome/browser/ui/views/payments/error_message_view_controller.h" |
14 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" | 14 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
15 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" | 15 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" |
16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 16 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
17 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" | 17 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
18 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" | 18 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
19 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll
er.h" | 19 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll
er.h" |
20 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" | 20 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
| 21 #include "components/autofill/core/browser/autofill_profile.h" |
| 22 #include "components/autofill/core/browser/credit_card.h" |
21 #include "components/constrained_window/constrained_window_views.h" | 23 #include "components/constrained_window/constrained_window_views.h" |
22 #include "components/payments/content/payment_request.h" | 24 #include "components/payments/content/payment_request.h" |
23 #include "components/strings/grit/components_strings.h" | 25 #include "components/strings/grit/components_strings.h" |
24 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
25 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
27 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
28 #include "ui/views/layout/fill_layout.h" | 30 #include "ui/views/layout/fill_layout.h" |
29 #include "ui/views/layout/grid_layout.h" | 31 #include "ui/views/layout/grid_layout.h" |
30 | 32 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 view_stack_.Push(CreateViewAndInstallController( | 207 view_stack_.Push(CreateViewAndInstallController( |
206 base::MakeUnique<CvcUnmaskViewController>( | 208 base::MakeUnique<CvcUnmaskViewController>( |
207 request_->spec(), request_->state(), this, | 209 request_->spec(), request_->state(), this, |
208 credit_card, result_delegate, web_contents), | 210 credit_card, result_delegate, web_contents), |
209 &controller_map_), | 211 &controller_map_), |
210 /* animate = */ true); | 212 /* animate = */ true); |
211 if (observer_for_testing_) | 213 if (observer_for_testing_) |
212 observer_for_testing_->OnCvcPromptShown(); | 214 observer_for_testing_->OnCvcPromptShown(); |
213 } | 215 } |
214 | 216 |
215 void PaymentRequestDialogView::ShowCreditCardEditor() { | 217 void PaymentRequestDialogView::ShowCreditCardEditor( |
216 view_stack_.Push(CreateViewAndInstallController( | 218 autofill::CreditCard* credit_card) { |
217 base::MakeUnique<CreditCardEditorViewController>( | 219 view_stack_.Push( |
218 request_->spec(), request_->state(), this), | 220 CreateViewAndInstallController( |
219 &controller_map_), | 221 base::MakeUnique<CreditCardEditorViewController>( |
220 /* animate = */ true); | 222 request_->spec(), request_->state(), this, credit_card), |
| 223 &controller_map_), |
| 224 /* animate = */ true); |
221 if (observer_for_testing_) | 225 if (observer_for_testing_) |
222 observer_for_testing_->OnCreditCardEditorOpened(); | 226 observer_for_testing_->OnCreditCardEditorOpened(); |
223 } | 227 } |
224 | 228 |
225 void PaymentRequestDialogView::ShowShippingAddressEditor() { | 229 void PaymentRequestDialogView::ShowShippingAddressEditor( |
| 230 autofill::AutofillProfile* profile) { |
226 view_stack_.Push(CreateViewAndInstallController( | 231 view_stack_.Push(CreateViewAndInstallController( |
227 base::MakeUnique<ShippingAddressEditorViewController>( | 232 base::MakeUnique<ShippingAddressEditorViewController>( |
228 request_->spec(), request_->state(), this), | 233 request_->spec(), request_->state(), this, profile), |
229 &controller_map_), | 234 &controller_map_), |
230 /* animate = */ true); | 235 /* animate = */ true); |
231 if (observer_for_testing_) | 236 if (observer_for_testing_) |
232 observer_for_testing_->OnShippingAddressEditorOpened(); | 237 observer_for_testing_->OnShippingAddressEditorOpened(); |
233 } | 238 } |
234 | 239 |
235 void PaymentRequestDialogView::EditorViewUpdated() { | 240 void PaymentRequestDialogView::EditorViewUpdated() { |
236 if (observer_for_testing_) | 241 if (observer_for_testing_) |
237 observer_for_testing_->OnEditorViewUpdated(); | 242 observer_for_testing_->OnEditorViewUpdated(); |
238 } | 243 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // When a view that is associated with a controller is removed from this | 307 // When a view that is associated with a controller is removed from this |
303 // view's descendants, dispose of the controller. | 308 // view's descendants, dispose of the controller. |
304 if (!details.is_add && | 309 if (!details.is_add && |
305 controller_map_.find(details.child) != controller_map_.end()) { | 310 controller_map_.find(details.child) != controller_map_.end()) { |
306 DCHECK(!details.move_view); | 311 DCHECK(!details.move_view); |
307 controller_map_.erase(details.child); | 312 controller_map_.erase(details.child); |
308 } | 313 } |
309 } | 314 } |
310 | 315 |
311 } // namespace payments | 316 } // namespace payments |
OLD | NEW |