| 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/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
" | 13 #include "chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
" |
| 13 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" | 14 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" |
| 14 #include "chrome/browser/ui/views/payments/cvc_unmask_view_controller.h" | 15 #include "chrome/browser/ui/views/payments/cvc_unmask_view_controller.h" |
| 15 #include "chrome/browser/ui/views/payments/error_message_view_controller.h" | 16 #include "chrome/browser/ui/views/payments/error_message_view_controller.h" |
| 16 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" | 17 #include "chrome/browser/ui/views/payments/order_summary_view_controller.h" |
| 17 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" | 18 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h" |
| 18 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 19 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 19 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" | 20 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 20 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" | 21 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
| 21 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll
er.h" | 22 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll
er.h" |
| 22 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" | 23 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
| 23 #include "components/autofill/core/browser/autofill_profile.h" | 24 #include "components/autofill/core/browser/autofill_profile.h" |
| 24 #include "components/autofill/core/browser/credit_card.h" | 25 #include "components/autofill/core/browser/credit_card.h" |
| 25 #include "components/constrained_window/constrained_window_views.h" | 26 #include "components/constrained_window/constrained_window_views.h" |
| 26 #include "components/payments/content/payment_request.h" | 27 #include "components/payments/content/payment_request.h" |
| 27 #include "components/strings/grit/components_strings.h" | 28 #include "components/strings/grit/components_strings.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/web_contents.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/views/background.h" | 32 #include "ui/views/background.h" |
| 31 #include "ui/views/controls/label.h" | 33 #include "ui/views/controls/label.h" |
| 32 #include "ui/views/layout/fill_layout.h" | 34 #include "ui/views/layout/fill_layout.h" |
| 33 #include "ui/views/layout/grid_layout.h" | 35 #include "ui/views/layout/grid_layout.h" |
| 34 | 36 |
| 35 namespace chrome { | 37 namespace chrome { |
| 36 | 38 |
| 37 payments::PaymentRequestDialog* CreatePaymentRequestDialog( | 39 payments::PaymentRequestDialog* CreatePaymentRequestDialog( |
| 38 payments::PaymentRequest* request) { | 40 payments::PaymentRequest* request) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 void PaymentRequestDialogView::EditorViewUpdated() { | 289 void PaymentRequestDialogView::EditorViewUpdated() { |
| 288 if (observer_for_testing_) | 290 if (observer_for_testing_) |
| 289 observer_for_testing_->OnEditorViewUpdated(); | 291 observer_for_testing_->OnEditorViewUpdated(); |
| 290 } | 292 } |
| 291 | 293 |
| 292 void PaymentRequestDialogView::ShowProcessingSpinner() { | 294 void PaymentRequestDialogView::ShowProcessingSpinner() { |
| 293 throbber_.Start(); | 295 throbber_.Start(); |
| 294 throbber_overlay_.SetVisible(true); | 296 throbber_overlay_.SetVisible(true); |
| 295 } | 297 } |
| 296 | 298 |
| 299 Profile* PaymentRequestDialogView::GetProfile() { |
| 300 return Profile::FromBrowserContext( |
| 301 request_->web_contents()->GetBrowserContext()); |
| 302 } |
| 303 |
| 297 void PaymentRequestDialogView::ShowInitialPaymentSheet() { | 304 void PaymentRequestDialogView::ShowInitialPaymentSheet() { |
| 298 view_stack_->Push(CreateViewAndInstallController( | 305 view_stack_->Push(CreateViewAndInstallController( |
| 299 base::MakeUnique<PaymentSheetViewController>( | 306 base::MakeUnique<PaymentSheetViewController>( |
| 300 request_->spec(), request_->state(), this), | 307 request_->spec(), request_->state(), this), |
| 301 &controller_map_), | 308 &controller_map_), |
| 302 /* animate = */ false); | 309 /* animate = */ false); |
| 303 if (observer_for_testing_) | 310 if (observer_for_testing_) |
| 304 observer_for_testing_->OnDialogOpened(); | 311 observer_for_testing_->OnDialogOpened(); |
| 305 } | 312 } |
| 306 | 313 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // When a view that is associated with a controller is removed from this | 361 // When a view that is associated with a controller is removed from this |
| 355 // view's descendants, dispose of the controller. | 362 // view's descendants, dispose of the controller. |
| 356 if (!details.is_add && | 363 if (!details.is_add && |
| 357 controller_map_.find(details.child) != controller_map_.end()) { | 364 controller_map_.find(details.child) != controller_map_.end()) { |
| 358 DCHECK(!details.move_view); | 365 DCHECK(!details.move_view); |
| 359 controller_map_.erase(details.child); | 366 controller_map_.erase(details.child); |
| 360 } | 367 } |
| 361 } | 368 } |
| 362 | 369 |
| 363 } // namespace payments | 370 } // namespace payments |
| OLD | NEW |