| 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 | |
| 132 // to and may need to access this during destruction. | |
| 133 layout_manager_.reset(); | |
| 134 | |
| 135 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { | 131 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { |
| 136 (*i)->parent_ = NULL; | 132 (*i)->parent_ = NULL; |
| 137 if (!(*i)->owned_by_client_) | 133 if (!(*i)->owned_by_client_) |
| 138 delete *i; | 134 delete *i; |
| 139 } | 135 } |
| 140 | 136 |
| 141 // Release ownership of the native accessibility object, but it's | 137 // Release ownership of the native accessibility object, but it's |
| 142 // reference-counted on some platforms, so it may not be deleted right away. | 138 // reference-counted on some platforms, so it may not be deleted right away. |
| 143 if (native_view_accessibility_) | 139 if (native_view_accessibility_) |
| 144 native_view_accessibility_->Destroy(); | 140 native_view_accessibility_->Destroy(); |
| (...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 // Message the RootView to do the drag and drop. That way if we're removed | 2418 // Message the RootView to do the drag and drop. That way if we're removed |
| 2423 // the RootView can detect it and avoid calling us back. | 2419 // the RootView can detect it and avoid calling us back. |
| 2424 gfx::Point widget_location(event.location()); | 2420 gfx::Point widget_location(event.location()); |
| 2425 ConvertPointToWidget(this, &widget_location); | 2421 ConvertPointToWidget(this, &widget_location); |
| 2426 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2427 // WARNING: we may have been deleted. | 2423 // WARNING: we may have been deleted. |
| 2428 return true; | 2424 return true; |
| 2429 } | 2425 } |
| 2430 | 2426 |
| 2431 } // namespace views | 2427 } // namespace views |
| OLD | NEW |