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

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

Issue 819793002: Reland: Fix crash when the source browser window is deleted during a drag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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 | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | 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 #include "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 return native_widget_private()->GetHostInputMethod(); 781 return native_widget_private()->GetHostInputMethod();
782 } 782 }
783 783
784 void Widget::RunShellDrag(View* view, 784 void Widget::RunShellDrag(View* view,
785 const ui::OSExchangeData& data, 785 const ui::OSExchangeData& data,
786 const gfx::Point& location, 786 const gfx::Point& location,
787 int operation, 787 int operation,
788 ui::DragDropTypes::DragEventSource source) { 788 ui::DragDropTypes::DragEventSource source) {
789 dragged_view_ = view; 789 dragged_view_ = view;
790 OnDragWillStart(); 790 OnDragWillStart();
791
792 WidgetDeletionObserver widget_deletion_observer(this);
791 native_widget_->RunShellDrag(view, data, location, operation, source); 793 native_widget_->RunShellDrag(view, data, location, operation, source);
794
795 // The widget may be destroyed during the drag operation.
796 if (!widget_deletion_observer.IsWidgetAlive())
797 return;
798
792 // If the view is removed during the drag operation, dragged_view_ is set to 799 // If the view is removed during the drag operation, dragged_view_ is set to
793 // NULL. 800 // NULL.
794 if (view && dragged_view_ == view) { 801 if (view && dragged_view_ == view) {
795 dragged_view_ = NULL; 802 dragged_view_ = NULL;
796 view->OnDragDone(); 803 view->OnDragDone();
797 } 804 }
798 OnDragComplete(); 805 OnDragComplete();
799 } 806 }
800 807
801 void Widget::SchedulePaintInRect(const gfx::Rect& rect) { 808 void Widget::SchedulePaintInRect(const gfx::Rect& rect) {
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 1524
1518 //////////////////////////////////////////////////////////////////////////////// 1525 ////////////////////////////////////////////////////////////////////////////////
1519 // internal::NativeWidgetPrivate, NativeWidget implementation: 1526 // internal::NativeWidgetPrivate, NativeWidget implementation:
1520 1527
1521 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1528 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1522 return this; 1529 return this;
1523 } 1530 }
1524 1531
1525 } // namespace internal 1532 } // namespace internal
1526 } // namespace views 1533 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698