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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 chrome::RecordDialogCreation(chrome::DialogIdentifier::PAYMENT_REQUEST); | 80 chrome::RecordDialogCreation(chrome::DialogIdentifier::PAYMENT_REQUEST); |
81 } | 81 } |
82 | 82 |
83 PaymentRequestDialogView::~PaymentRequestDialogView() {} | 83 PaymentRequestDialogView::~PaymentRequestDialogView() {} |
84 | 84 |
85 ui::ModalType PaymentRequestDialogView::GetModalType() const { | 85 ui::ModalType PaymentRequestDialogView::GetModalType() const { |
86 return ui::MODAL_TYPE_CHILD; | 86 return ui::MODAL_TYPE_CHILD; |
87 } | 87 } |
88 | 88 |
| 89 views::View* PaymentRequestDialogView::GetInitiallyFocusedView() { |
| 90 return view_stack_.get(); |
| 91 } |
| 92 |
89 bool PaymentRequestDialogView::Cancel() { | 93 bool PaymentRequestDialogView::Cancel() { |
90 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
91 // Called when the widget is about to close. We send a message to the | 95 // Called when the widget is about to close. We send a message to the |
92 // PaymentRequest object to signal user cancellation. | 96 // PaymentRequest object to signal user cancellation. |
93 // | 97 // |
94 // The order of destruction is important here. First destroy all the views | 98 // The order of destruction is important here. First destroy all the views |
95 // because they may have pointers/delegates to their controllers. Then destroy | 99 // because they may have pointers/delegates to their controllers. Then destroy |
96 // all the controllers, because they may have pointers to PaymentRequestSpec/ | 100 // all the controllers, because they may have pointers to PaymentRequestSpec/ |
97 // PaymentRequestState. Then send the signal to PaymentRequest to destroy. | 101 // PaymentRequestState. Then send the signal to PaymentRequest to destroy. |
98 being_closed_ = true; | 102 being_closed_ = true; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // When a view that is associated with a controller is removed from this | 347 // When a view that is associated with a controller is removed from this |
344 // view's descendants, dispose of the controller. | 348 // view's descendants, dispose of the controller. |
345 if (!details.is_add && | 349 if (!details.is_add && |
346 controller_map_.find(details.child) != controller_map_.end()) { | 350 controller_map_.find(details.child) != controller_map_.end()) { |
347 DCHECK(!details.move_view); | 351 DCHECK(!details.move_view); |
348 controller_map_.erase(details.child); | 352 controller_map_.erase(details.child); |
349 } | 353 } |
350 } | 354 } |
351 | 355 |
352 } // namespace payments | 356 } // namespace payments |
OLD | NEW |