| 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_request_views_util.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" | 15 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 15 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" | 16 #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" | 17 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll
er.h" |
| 17 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" | 18 #include "chrome/browser/ui/views/payments/shipping_option_view_controller.h" |
| 18 #include "components/constrained_window/constrained_window_views.h" | 19 #include "components/constrained_window/constrained_window_views.h" |
| 19 #include "components/payments/content/payment_request.h" | 20 #include "components/payments/content/payment_request.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
| 22 | 23 |
| 23 namespace chrome { | 24 namespace chrome { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 view_stack_.Push(CreateViewAndInstallController( | 196 view_stack_.Push(CreateViewAndInstallController( |
| 196 base::MakeUnique<PaymentSheetViewController>( | 197 base::MakeUnique<PaymentSheetViewController>( |
| 197 request_->spec(), request_->state(), this), | 198 request_->spec(), request_->state(), this), |
| 198 &controller_map_), | 199 &controller_map_), |
| 199 /* animate = */ false); | 200 /* animate = */ false); |
| 200 if (observer_for_testing_) | 201 if (observer_for_testing_) |
| 201 observer_for_testing_->OnDialogOpened(); | 202 observer_for_testing_->OnDialogOpened(); |
| 202 } | 203 } |
| 203 | 204 |
| 204 gfx::Size PaymentRequestDialogView::GetPreferredSize() const { | 205 gfx::Size PaymentRequestDialogView::GetPreferredSize() const { |
| 205 return gfx::Size(450, 450); | 206 return gfx::Size(kDialogWidth, kDialogHeight); |
| 206 } | 207 } |
| 207 | 208 |
| 208 void PaymentRequestDialogView::ViewHierarchyChanged( | 209 void PaymentRequestDialogView::ViewHierarchyChanged( |
| 209 const ViewHierarchyChangedDetails& details) { | 210 const ViewHierarchyChangedDetails& details) { |
| 210 if (being_closed_) | 211 if (being_closed_) |
| 211 return; | 212 return; |
| 212 | 213 |
| 213 // When a view that is associated with a controller is removed from this | 214 // When a view that is associated with a controller is removed from this |
| 214 // view's descendants, dispose of the controller. | 215 // view's descendants, dispose of the controller. |
| 215 if (!details.is_add && | 216 if (!details.is_add && |
| 216 controller_map_.find(details.child) != controller_map_.end()) { | 217 controller_map_.find(details.child) != controller_map_.end()) { |
| 217 DCHECK(!details.move_view); | 218 DCHECK(!details.move_view); |
| 218 controller_map_.erase(details.child); | 219 controller_map_.erase(details.child); |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 222 } // namespace payments | 223 } // namespace payments |
| OLD | NEW |