Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 } | 154 } |
| 155 | 155 |
| 156 gfx::Size PaymentRequestDialogView::GetPreferredSize() const { | 156 gfx::Size PaymentRequestDialogView::GetPreferredSize() const { |
| 157 return gfx::Size(450, 450); | 157 return gfx::Size(450, 450); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void PaymentRequestDialogView::ViewHierarchyChanged( | 160 void PaymentRequestDialogView::ViewHierarchyChanged( |
| 161 const ViewHierarchyChangedDetails& details) { | 161 const ViewHierarchyChangedDetails& details) { |
| 162 // When a view that is associated with a controller is removed from this | 162 // When a view that is associated with a controller is removed from this |
| 163 // view's descendants, dispose of the controller. | 163 // view's descendants, dispose of the controller. |
| 164 | |
| 165 // DO NOT SUBMIT Note to reviewer: When we are here, I believe the View is | |
|
Mathieu
2017/02/14 21:23:54
See this comment
| |
| 166 // still valid and not yet destroyed. Line 176 destroys the controller, which | |
| 167 // is problematic when the View does get destroyed (see comment in | |
| 168 // credit_card_editor_view_controller.h). Can we get notified *after* a View | |
| 169 // has been destroyed? Can WidgetObserver observe the view's widget through | |
| 170 // OnWidgetDestroyed, so that |details.child->GetWidget()| could become the | |
| 171 // key to |controller_map_|? I'm not familiar with GetWidget() enough to know | |
| 172 // whether observing the Widget is equivalent to observing the View. | |
|
sky
2017/02/14 23:19:24
Is the only way you get here if the ViewStack remo
| |
| 164 if (!details.is_add && | 173 if (!details.is_add && |
| 165 controller_map_.find(details.child) != controller_map_.end()) { | 174 controller_map_.find(details.child) != controller_map_.end()) { |
| 166 DCHECK(!details.move_view); | 175 DCHECK(!details.move_view); |
| 167 controller_map_.erase(details.child); | 176 controller_map_.erase(details.child); |
| 168 } | 177 } |
| 169 } | 178 } |
| 170 | 179 |
| 171 } // namespace payments | 180 } // namespace payments |
| OLD | NEW |