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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // See if this view wants to handle the mouse press. 426 // See if this view wants to handle the mouse press.
427 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this), 427 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this),
428 mouse_pressed_handler_); 428 mouse_pressed_handler_);
429 429
430 // Remove the double-click flag if the handler is different than the 430 // Remove the double-click flag if the handler is different than the
431 // one which got the first click part of the double-click. 431 // one which got the first click part of the double-click.
432 if (mouse_pressed_handler_ != last_click_handler_) 432 if (mouse_pressed_handler_ != last_click_handler_)
433 mouse_pressed_event.set_flags(event.flags() & ~ui::EF_IS_DOUBLE_CLICK); 433 mouse_pressed_event.set_flags(event.flags() & ~ui::EF_IS_DOUBLE_CLICK);
434 434
435 drag_info_.Reset(); 435 drag_info_.Reset();
436 DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event); 436 {
437 WidgetDeletionObserver widget_deletion_observer(widget_);
438 DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event);
439 if (!widget_deletion_observer.IsWidgetAlive())
440 return mouse_pressed_event.handled();
441 }
437 442
438 // The view could have removed itself from the tree when handling 443 // The view could have removed itself from the tree when handling
439 // OnMousePressed(). In this case, the removal notification will have 444 // OnMousePressed(). In this case, the removal notification will have
440 // reset mouse_pressed_handler_ to NULL out from under us. Detect this 445 // reset mouse_pressed_handler_ to NULL out from under us. Detect this
441 // case and stop. (See comments in view.h.) 446 // case and stop. (See comments in view.h.)
442 // 447 //
443 // NOTE: Don't return true here, because we don't want the frame to 448 // NOTE: Don't return true here, because we don't want the frame to
444 // forward future events to us when there's no handler. 449 // forward future events to us when there's no handler.
445 if (!mouse_pressed_handler_) 450 if (!mouse_pressed_handler_)
446 break; 451 break;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 DispatchEventToTarget(p, &notify_event); 697 DispatchEventToTarget(p, &notify_event);
693 } 698 }
694 } 699 }
695 700
696 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { 701 bool RootView::CanDispatchToTarget(ui::EventTarget* target) {
697 return event_dispatch_target_ == target; 702 return event_dispatch_target_ == target;
698 } 703 }
699 704
700 } // namespace internal 705 } // namespace internal
701 } // namespace views 706 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698