OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ViewStorage::GetInstance()->ViewRemoved(this); | 156 ViewStorage::GetInstance()->ViewRemoved(this); |
157 | 157 |
158 { | 158 { |
159 internal::ScopedChildrenLock lock(this); | 159 internal::ScopedChildrenLock lock(this); |
160 for (auto* child : children_) { | 160 for (auto* child : children_) { |
161 child->parent_ = NULL; | 161 child->parent_ = NULL; |
162 if (!child->owned_by_client_) | 162 if (!child->owned_by_client_) |
163 delete child; | 163 delete child; |
164 } | 164 } |
165 } | 165 } |
| 166 |
| 167 for (ViewObserver& observer : observers_) |
| 168 observer.OnViewIsDeleting(this); |
166 } | 169 } |
167 | 170 |
168 // Tree operations ------------------------------------------------------------- | 171 // Tree operations ------------------------------------------------------------- |
169 | 172 |
170 const Widget* View::GetWidget() const { | 173 const Widget* View::GetWidget() const { |
171 // The root view holds a reference to this view hierarchy's Widget. | 174 // The root view holds a reference to this view hierarchy's Widget. |
172 return parent_ ? parent_->GetWidget() : NULL; | 175 return parent_ ? parent_->GetWidget() : NULL; |
173 } | 176 } |
174 | 177 |
175 Widget* View::GetWidget() { | 178 Widget* View::GetWidget() { |
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 // Message the RootView to do the drag and drop. That way if we're removed | 2565 // Message the RootView to do the drag and drop. That way if we're removed |
2563 // the RootView can detect it and avoid calling us back. | 2566 // the RootView can detect it and avoid calling us back. |
2564 gfx::Point widget_location(event.location()); | 2567 gfx::Point widget_location(event.location()); |
2565 ConvertPointToWidget(this, &widget_location); | 2568 ConvertPointToWidget(this, &widget_location); |
2566 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2569 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2567 // WARNING: we may have been deleted. | 2570 // WARNING: we may have been deleted. |
2568 return true; | 2571 return true; |
2569 } | 2572 } |
2570 | 2573 |
2571 } // namespace views | 2574 } // namespace views |
OLD | NEW |