Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: ui/views/view.cc

Issue 1624343003: Minor fixes for WidgetRemovalsObserver::OnWillRemoveView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 if (prev_focusable) 1796 if (prev_focusable)
1797 prev_focusable->next_focusable_view_ = next_focusable; 1797 prev_focusable->next_focusable_view_ = next_focusable;
1798 if (next_focusable) 1798 if (next_focusable)
1799 next_focusable->previous_focusable_view_ = prev_focusable; 1799 next_focusable->previous_focusable_view_ = prev_focusable;
1800 } 1800 }
1801 1801
1802 if (GetWidget()) { 1802 if (GetWidget()) {
1803 UnregisterChildrenForVisibleBoundsNotification(view); 1803 UnregisterChildrenForVisibleBoundsNotification(view);
1804 if (view->visible()) 1804 if (view->visible())
1805 view->SchedulePaint(); 1805 view->SchedulePaint();
1806 GetWidget()->NotifyWillRemoveView(view);
1807 } 1806 }
1808 1807
1809 view->PropagateRemoveNotifications(this, new_parent); 1808 view->PropagateRemoveNotifications(this, new_parent);
1810 view->parent_ = NULL; 1809 view->parent_ = NULL;
1811 view->UpdateLayerVisibility(); 1810 view->UpdateLayerVisibility();
1812 1811
1813 if (delete_removed_view && !view->owned_by_client_) 1812 if (delete_removed_view && !view->owned_by_client_)
1814 view_to_be_deleted.reset(view); 1813 view_to_be_deleted.reset(view);
1815 1814
1816 children_.erase(i); 1815 children_.erase(i);
1817 } 1816 }
1818 1817
1819 if (update_tool_tip) 1818 if (update_tool_tip)
1820 UpdateTooltip(); 1819 UpdateTooltip();
1821 1820
1822 if (layout_manager_.get()) 1821 if (layout_manager_.get())
1823 layout_manager_->ViewRemoved(this, view); 1822 layout_manager_->ViewRemoved(this, view);
1824 } 1823 }
1825 1824
1826 void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) { 1825 void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) {
1826 if (GetWidget())
1827 GetWidget()->NotifyWillRemoveView(this);
sky 2016/01/25 21:22:14 Doing this here means we have to constantly to det
dmazzoni 2016/01/25 21:44:27 OK, moved to a separate helper that takes the widg
1828
1827 for (int i = 0, count = child_count(); i < count; ++i) 1829 for (int i = 0, count = child_count(); i < count; ++i)
1828 child_at(i)->PropagateRemoveNotifications(old_parent, new_parent); 1830 child_at(i)->PropagateRemoveNotifications(old_parent, new_parent);
1829 1831
1830 ViewHierarchyChangedDetails details(false, old_parent, this, new_parent); 1832 ViewHierarchyChangedDetails details(false, old_parent, this, new_parent);
1831 for (View* v = this; v; v = v->parent_) 1833 for (View* v = this; v; v = v->parent_)
1832 v->ViewHierarchyChangedImpl(true, details); 1834 v->ViewHierarchyChangedImpl(true, details);
1833 } 1835 }
1834 1836
1835 void View::PropagateAddNotifications( 1837 void View::PropagateAddNotifications(
1836 const ViewHierarchyChangedDetails& details) { 1838 const ViewHierarchyChangedDetails& details) {
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 // 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
2405 // the RootView can detect it and avoid calling us back. 2407 // the RootView can detect it and avoid calling us back.
2406 gfx::Point widget_location(event.location()); 2408 gfx::Point widget_location(event.location());
2407 ConvertPointToWidget(this, &widget_location); 2409 ConvertPointToWidget(this, &widget_location);
2408 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2410 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2409 // WARNING: we may have been deleted. 2411 // WARNING: we may have been deleted.
2410 return true; 2412 return true;
2411 } 2413 }
2412 2414
2413 } // namespace views 2415 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698