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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 if (update_focus_cycle) { | 1791 if (update_focus_cycle) { |
1792 // Let's remove the view from the focus traversal. | 1792 // Let's remove the view from the focus traversal. |
1793 View* next_focusable = view->next_focusable_view_; | 1793 View* next_focusable = view->next_focusable_view_; |
1794 View* prev_focusable = view->previous_focusable_view_; | 1794 View* prev_focusable = view->previous_focusable_view_; |
1795 if (prev_focusable) | 1795 if (prev_focusable) |
1796 prev_focusable->next_focusable_view_ = next_focusable; | 1796 prev_focusable->next_focusable_view_ = next_focusable; |
1797 if (next_focusable) | 1797 if (next_focusable) |
1798 next_focusable->previous_focusable_view_ = prev_focusable; | 1798 next_focusable->previous_focusable_view_ = prev_focusable; |
1799 } | 1799 } |
1800 | 1800 |
1801 if (GetWidget()) { | 1801 Widget* widget = GetWidget(); |
| 1802 if (widget) { |
1802 UnregisterChildrenForVisibleBoundsNotification(view); | 1803 UnregisterChildrenForVisibleBoundsNotification(view); |
1803 if (view->visible()) | 1804 if (view->visible()) |
1804 view->SchedulePaint(); | 1805 view->SchedulePaint(); |
1805 GetWidget()->NotifyWillRemoveView(view); | 1806 |
| 1807 if (!new_parent || new_parent->GetWidget() != widget) |
| 1808 widget->NotifyWillRemoveView(view); |
1806 } | 1809 } |
1807 | 1810 |
1808 view->PropagateRemoveNotifications(this, new_parent); | 1811 view->PropagateRemoveNotifications(this, new_parent); |
1809 view->parent_ = NULL; | 1812 view->parent_ = NULL; |
1810 view->UpdateLayerVisibility(); | 1813 view->UpdateLayerVisibility(); |
1811 | 1814 |
1812 if (delete_removed_view && !view->owned_by_client_) | 1815 if (delete_removed_view && !view->owned_by_client_) |
1813 view_to_be_deleted.reset(view); | 1816 view_to_be_deleted.reset(view); |
1814 | 1817 |
1815 children_.erase(i); | 1818 children_.erase(i); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 // Message the RootView to do the drag and drop. That way if we're removed | 2406 // Message the RootView to do the drag and drop. That way if we're removed |
2404 // the RootView can detect it and avoid calling us back. | 2407 // the RootView can detect it and avoid calling us back. |
2405 gfx::Point widget_location(event.location()); | 2408 gfx::Point widget_location(event.location()); |
2406 ConvertPointToWidget(this, &widget_location); | 2409 ConvertPointToWidget(this, &widget_location); |
2407 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2410 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2408 // WARNING: we may have been deleted. | 2411 // WARNING: we may have been deleted. |
2409 return true; | 2412 return true; |
2410 } | 2413 } |
2411 | 2414 |
2412 } // namespace views | 2415 } // namespace views |
OLD | NEW |