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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 native_view_accessibility_(NULL) { | 121 native_view_accessibility_(NULL) { |
122 SetTargetHandler(this); | 122 SetTargetHandler(this); |
123 } | 123 } |
124 | 124 |
125 View::~View() { | 125 View::~View() { |
126 if (parent_) | 126 if (parent_) |
127 parent_->RemoveChildView(this); | 127 parent_->RemoveChildView(this); |
128 | 128 |
129 ViewStorage::GetInstance()->ViewRemoved(this); | 129 ViewStorage::GetInstance()->ViewRemoved(this); |
130 | 130 |
131 // Some layout managers hold a reference to the host that they are installed | |
sky
2016/10/20 15:59:11
I have a mild preference to move this after deleti
bruthig
2016/10/20 19:01:34
The risk in doing so is that View may try to acces
sky
2016/10/20 20:42:22
Now that I look at this code again I think the way
bruthig
2016/10/20 21:00:48
Done.
| |
132 // to and may need to access this during destruction. | |
133 layout_manager_.reset(); | |
134 | |
131 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { | 135 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { |
132 (*i)->parent_ = NULL; | 136 (*i)->parent_ = NULL; |
133 if (!(*i)->owned_by_client_) | 137 if (!(*i)->owned_by_client_) |
134 delete *i; | 138 delete *i; |
135 } | 139 } |
136 | 140 |
137 // Release ownership of the native accessibility object, but it's | 141 // Release ownership of the native accessibility object, but it's |
138 // reference-counted on some platforms, so it may not be deleted right away. | 142 // reference-counted on some platforms, so it may not be deleted right away. |
139 if (native_view_accessibility_) | 143 if (native_view_accessibility_) |
140 native_view_accessibility_->Destroy(); | 144 native_view_accessibility_->Destroy(); |
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2418 // Message the RootView to do the drag and drop. That way if we're removed | 2422 // Message the RootView to do the drag and drop. That way if we're removed |
2419 // the RootView can detect it and avoid calling us back. | 2423 // the RootView can detect it and avoid calling us back. |
2420 gfx::Point widget_location(event.location()); | 2424 gfx::Point widget_location(event.location()); |
2421 ConvertPointToWidget(this, &widget_location); | 2425 ConvertPointToWidget(this, &widget_location); |
2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2426 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2423 // WARNING: we may have been deleted. | 2427 // WARNING: we may have been deleted. |
2424 return true; | 2428 return true; |
2425 } | 2429 } |
2426 | 2430 |
2427 } // namespace views | 2431 } // namespace views |
OLD | NEW |