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

Unified Diff: ui/views/widget/root_view.cc

Issue 12529012: Context menu on views must show on mouse down for non-WIN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index 1092f2dbd6b95e285e08be18136387146af17342..0d3d0d33dae3d94d3169ee8acbc673aaafa1a378 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -18,6 +18,7 @@
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
+#include "ui/views/widget/widget_deletion_observer.h"
namespace views {
namespace internal {
@@ -433,7 +434,12 @@ bool RootView::OnMousePressed(const ui::MouseEvent& event) {
mouse_pressed_event.set_flags(event.flags() & ~ui::EF_IS_DOUBLE_CLICK);
drag_info_.Reset();
- DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event);
+ {
+ WidgetDeletionObserver widget_deletion_observer(widget_);
+ DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event);
+ if (!widget_deletion_observer.IsWidgetAlive())
+ return mouse_pressed_event.handled();
+ }
// The view could have removed itself from the tree when handling
// OnMousePressed(). In this case, the removal notification will have
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698