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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_)) | 371 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_)) |
372 mouse_moved_handler_ = NULL; | 372 mouse_moved_handler_ = NULL; |
373 | 373 |
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 || details.target_destroyed) |
sky
2014/10/21 02:45:32
If target_destroyed is true, isn't the only thing
mfomitchev
2014/10/21 20:02:03
Done.
| |
382 return; | 382 return; |
383 | 383 |
384 old_capture->delegate()->OnCaptureLost(); | 384 old_capture->delegate()->OnCaptureLost(); |
385 } | 385 } |
386 | 386 |
387 if (new_capture) { | 387 if (new_capture) { |
388 // Make all subsequent mouse events go to the capture window. We shouldn't | 388 // 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. | 389 // need to send an event here as OnCaptureLost() should take care of that. |
390 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown()) | 390 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown()) |
391 mouse_moved_handler_ = new_capture; | 391 mouse_moved_handler_ = new_capture; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
897 | 897 |
898 default: | 898 default: |
899 NOTREACHED(); | 899 NOTREACHED(); |
900 break; | 900 break; |
901 } | 901 } |
902 | 902 |
903 PreDispatchLocatedEvent(target, event); | 903 PreDispatchLocatedEvent(target, event); |
904 } | 904 } |
905 | 905 |
906 } // namespace aura | 906 } // namespace aura |
OLD | NEW |