OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/root_view.h" | 5 #include "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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // configure state such that we're done first, then call View. | 264 // configure state such that we're done first, then call View. |
265 View* mouse_pressed_handler = mouse_pressed_handler_; | 265 View* mouse_pressed_handler = mouse_pressed_handler_; |
266 SetMouseHandler(NULL); | 266 SetMouseHandler(NULL); |
267 mouse_pressed_handler->ProcessMouseReleased(mouse_released); | 267 mouse_pressed_handler->ProcessMouseReleased(mouse_released); |
268 // WARNING: we may have been deleted. | 268 // WARNING: we may have been deleted. |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 void RootView::OnMouseCaptureLost() { | 272 void RootView::OnMouseCaptureLost() { |
273 if (mouse_pressed_handler_) { | 273 if (mouse_pressed_handler_) { |
274 // Synthesize a release event for UpdateCursor and OnMouseReleased. | 274 // Synthesize a release event for UpdateCursor. |
275 MouseEvent release_event(ui::ET_MOUSE_RELEASED, last_mouse_event_x_, | 275 MouseEvent release_event(ui::ET_MOUSE_RELEASED, last_mouse_event_x_, |
276 last_mouse_event_y_, last_mouse_event_flags_); | 276 last_mouse_event_y_, last_mouse_event_flags_); |
277 UpdateCursor(release_event); | 277 UpdateCursor(release_event); |
278 // We allow the view to delete us from OnMouseCaptureLost. As such, | 278 // We allow the view to delete us from OnMouseCaptureLost. As such, |
279 // configure state such that we're done first, then call View. | 279 // configure state such that we're done first, then call View. |
280 View* mouse_pressed_handler = mouse_pressed_handler_; | 280 View* mouse_pressed_handler = mouse_pressed_handler_; |
281 SetMouseHandler(NULL); | 281 SetMouseHandler(NULL); |
282 mouse_pressed_handler->OnMouseCaptureLost(); | 282 mouse_pressed_handler->OnMouseCaptureLost(); |
283 // WARNING: we may have been deleted. | 283 // WARNING: we may have been deleted. |
284 } | 284 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 widget_->SetCursor(cursor); | 473 widget_->SetCursor(cursor); |
474 } | 474 } |
475 | 475 |
476 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 476 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
477 last_mouse_event_flags_ = event.flags(); | 477 last_mouse_event_flags_ = event.flags(); |
478 last_mouse_event_x_ = event.x(); | 478 last_mouse_event_x_ = event.x(); |
479 last_mouse_event_y_ = event.y(); | 479 last_mouse_event_y_ = event.y(); |
480 } | 480 } |
481 | 481 |
482 } // namespace views | 482 } // namespace views |
OLD | NEW |