| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 void RootView::OnMouseCaptureLost() { | 518 void RootView::OnMouseCaptureLost() { |
| 519 // TODO: this likely needs to reset touch handler too. | 519 // TODO: this likely needs to reset touch handler too. |
| 520 | 520 |
| 521 if (mouse_pressed_handler_ || gesture_handler_) { | 521 if (mouse_pressed_handler_ || gesture_handler_) { |
| 522 // Synthesize a release event for UpdateCursor. | 522 // Synthesize a release event for UpdateCursor. |
| 523 if (mouse_pressed_handler_) { | 523 if (mouse_pressed_handler_) { |
| 524 gfx::Point last_point(last_mouse_event_x_, last_mouse_event_y_); | 524 gfx::Point last_point(last_mouse_event_x_, last_mouse_event_y_); |
| 525 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, | 525 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, |
| 526 last_point, last_point, | 526 last_point, last_point, |
| 527 last_mouse_event_flags_); | 527 last_mouse_event_flags_, |
| 528 0); |
| 528 UpdateCursor(release_event); | 529 UpdateCursor(release_event); |
| 529 } | 530 } |
| 530 // We allow the view to delete us from OnMouseCaptureLost. As such, | 531 // We allow the view to delete us from OnMouseCaptureLost. As such, |
| 531 // configure state such that we're done first, then call View. | 532 // configure state such that we're done first, then call View. |
| 532 View* mouse_pressed_handler = mouse_pressed_handler_; | 533 View* mouse_pressed_handler = mouse_pressed_handler_; |
| 533 View* gesture_handler = gesture_handler_; | 534 View* gesture_handler = gesture_handler_; |
| 534 SetMouseHandler(NULL); | 535 SetMouseHandler(NULL); |
| 535 if (mouse_pressed_handler) | 536 if (mouse_pressed_handler) |
| 536 mouse_pressed_handler->OnMouseCaptureLost(); | 537 mouse_pressed_handler->OnMouseCaptureLost(); |
| 537 else | 538 else |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 return; | 739 return; |
| 739 } | 740 } |
| 740 } | 741 } |
| 741 | 742 |
| 742 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { | 743 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { |
| 743 return event_dispatch_target_ == target; | 744 return event_dispatch_target_ == target; |
| 744 } | 745 } |
| 745 | 746 |
| 746 } // namespace internal | 747 } // namespace internal |
| 747 } // namespace views | 748 } // namespace views |
| OLD | NEW |