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 #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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // it must be marked as handled to avoid anything happening from default | 422 // it must be marked as handled to avoid anything happening from default |
423 // processing if it the first click-part was handled by us. | 423 // processing if it the first click-part was handled by us. |
424 if (last_click_handler_ && (event.flags() & ui::EF_IS_DOUBLE_CLICK)) | 424 if (last_click_handler_ && (event.flags() & ui::EF_IS_DOUBLE_CLICK)) |
425 hit_disabled_view = true; | 425 hit_disabled_view = true; |
426 | 426 |
427 last_click_handler_ = NULL; | 427 last_click_handler_ = NULL; |
428 return hit_disabled_view; | 428 return hit_disabled_view; |
429 } | 429 } |
430 | 430 |
431 bool RootView::OnMouseDragged(const ui::MouseEvent& event) { | 431 bool RootView::OnMouseDragged(const ui::MouseEvent& event) { |
432 CHECK_EQ(ui::ET_MOUSE_DRAGGED, event.type()); | |
433 if (mouse_pressed_handler_) { | 432 if (mouse_pressed_handler_) { |
434 SetMouseLocationAndFlags(event); | 433 SetMouseLocationAndFlags(event); |
435 | 434 |
436 ui::MouseEvent mouse_event(event, static_cast<View*>(this), | 435 ui::MouseEvent mouse_event(event, static_cast<View*>(this), |
437 mouse_pressed_handler_); | 436 mouse_pressed_handler_); |
438 ui::EventDispatchDetails dispatch_details = | 437 ui::EventDispatchDetails dispatch_details = |
439 DispatchEvent(mouse_pressed_handler_, &mouse_event); | 438 DispatchEvent(mouse_pressed_handler_, &mouse_event); |
440 if (dispatch_details.dispatcher_destroyed) | 439 if (dispatch_details.dispatcher_destroyed) |
441 return false; | 440 return false; |
442 } | 441 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 SetMouseHandler(NULL); | 479 SetMouseHandler(NULL); |
481 if (mouse_pressed_handler) | 480 if (mouse_pressed_handler) |
482 mouse_pressed_handler->OnMouseCaptureLost(); | 481 mouse_pressed_handler->OnMouseCaptureLost(); |
483 else | 482 else |
484 gesture_handler->OnMouseCaptureLost(); | 483 gesture_handler->OnMouseCaptureLost(); |
485 // WARNING: we may have been deleted. | 484 // WARNING: we may have been deleted. |
486 } | 485 } |
487 } | 486 } |
488 | 487 |
489 void RootView::OnMouseMoved(const ui::MouseEvent& event) { | 488 void RootView::OnMouseMoved(const ui::MouseEvent& event) { |
490 CHECK_EQ(ui::ET_MOUSE_MOVED, event.type()); | |
491 View* v = GetEventHandlerForPoint(event.location()); | 489 View* v = GetEventHandlerForPoint(event.location()); |
492 // Find the first enabled view, or the existing move handler, whichever comes | 490 // Find the first enabled view, or the existing move handler, whichever comes |
493 // first. The check for the existing handler is because if a view becomes | 491 // first. The check for the existing handler is because if a view becomes |
494 // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED | 492 // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED |
495 // and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet. | 493 // and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet. |
496 while (v && !v->enabled() && (v != mouse_move_handler_)) | 494 while (v && !v->enabled() && (v != mouse_move_handler_)) |
497 v = v->parent(); | 495 v = v->parent(); |
498 if (v && v != this) { | 496 if (v && v != this) { |
499 if (v != mouse_move_handler_) { | 497 if (v != mouse_move_handler_) { |
500 if (mouse_move_handler_ != NULL && | 498 if (mouse_move_handler_ != NULL && |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 737 |
740 #ifndef NDEBUG | 738 #ifndef NDEBUG |
741 DCHECK(!event_dispatch_target_ || Contains(event_dispatch_target_)); | 739 DCHECK(!event_dispatch_target_ || Contains(event_dispatch_target_)); |
742 #endif | 740 #endif |
743 | 741 |
744 return details; | 742 return details; |
745 } | 743 } |
746 | 744 |
747 } // namespace internal | 745 } // namespace internal |
748 } // namespace views | 746 } // namespace views |
OLD | NEW |