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