OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 if (old_capture && old_capture->GetRootWindow() == window() && | 374 if (old_capture && old_capture->GetRootWindow() == window() && |
375 old_capture->delegate()) { | 375 old_capture->delegate()) { |
376 // Send a capture changed event with bogus location data. | 376 // Send a capture changed event with bogus location data. |
377 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), | 377 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), |
378 gfx::Point(), 0, 0); | 378 gfx::Point(), 0, 0); |
379 | 379 |
380 DispatchDetails details = DispatchEvent(old_capture, &event); | 380 DispatchDetails details = DispatchEvent(old_capture, &event); |
381 if (details.dispatcher_destroyed) | 381 if (details.dispatcher_destroyed) |
382 return; | 382 return; |
383 | 383 |
384 old_capture->delegate()->OnCaptureLost(); | 384 if (!details.target_destroyed) |
| 385 old_capture->delegate()->OnCaptureLost(); |
385 } | 386 } |
386 | 387 |
387 if (new_capture) { | 388 if (new_capture) { |
388 // Make all subsequent mouse events go to the capture window. We shouldn't | 389 // Make all subsequent mouse events go to the capture window. We shouldn't |
389 // need to send an event here as OnCaptureLost() should take care of that. | 390 // need to send an event here as OnCaptureLost() should take care of that. |
390 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown()) | 391 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown()) |
391 mouse_moved_handler_ = new_capture; | 392 mouse_moved_handler_ = new_capture; |
392 } else { | 393 } else { |
393 // Make sure mouse_moved_handler gets updated. | 394 // Make sure mouse_moved_handler gets updated. |
394 DispatchDetails details = SynthesizeMouseMoveEvent(); | 395 DispatchDetails details = SynthesizeMouseMoveEvent(); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 898 |
898 default: | 899 default: |
899 NOTREACHED(); | 900 NOTREACHED(); |
900 break; | 901 break; |
901 } | 902 } |
902 | 903 |
903 PreDispatchLocatedEvent(target, event); | 904 PreDispatchLocatedEvent(target, event); |
904 } | 905 } |
905 | 906 |
906 } // namespace aura | 907 } // namespace aura |
OLD | NEW |