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 "ash/wm/toplevel_window_event_handler.h" | 5 #include "ash/wm/toplevel_window_event_handler.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/resize_shadow_controller.h" | 8 #include "ash/wm/resize_shadow_controller.h" |
9 #include "ash/wm/window_resizer.h" | 9 #include "ash/wm/window_resizer.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 CompleteDrag(DRAG_COMPLETE); | 487 CompleteDrag(DRAG_COMPLETE); |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 void ToplevelWindowEventHandler::HandleMouseReleased( | 491 void ToplevelWindowEventHandler::HandleMouseReleased( |
492 aura::Window* target, | 492 aura::Window* target, |
493 ui::MouseEvent* event) { | 493 ui::MouseEvent* event) { |
494 if (event->phase() != ui::EP_PRETARGET) | 494 if (event->phase() != ui::EP_PRETARGET) |
495 return; | 495 return; |
496 | 496 |
497 CompleteDrag(event->type() == ui::ET_MOUSE_RELEASED ? | 497 if (window_resizer_) { |
498 DRAG_COMPLETE : DRAG_REVERT); | 498 CompleteDrag(event->type() == ui::ET_MOUSE_RELEASED ? |
| 499 DRAG_COMPLETE : DRAG_REVERT); |
| 500 } |
| 501 |
499 // Completing the drag may result in hiding the window. If this happens | 502 // Completing the drag may result in hiding the window. If this happens |
500 // mark the event as handled so no other handlers/observers act upon the | 503 // mark the event as handled so no other handlers/observers act upon the |
501 // event. They should see the event on a hidden window, to determine targets | 504 // event. They should see the event on a hidden window, to determine targets |
502 // of destructive actions such as hiding. They should not act upon them. | 505 // of destructive actions such as hiding. They should not act upon them. |
503 if (window_resizer_ && | 506 if (window_resizer_ && |
504 event->type() == ui::ET_MOUSE_CAPTURE_CHANGED && | 507 event->type() == ui::ET_MOUSE_CAPTURE_CHANGED && |
505 !target->IsVisible()) { | 508 !target->IsVisible()) { |
506 event->SetHandled(); | 509 event->SetHandled(); |
507 } | 510 } |
508 } | 511 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 612 |
610 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 613 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
611 // We explicitly don't invoke RevertDrag() since that may do things to window. | 614 // We explicitly don't invoke RevertDrag() since that may do things to window. |
612 // Instead we destroy the resizer. | 615 // Instead we destroy the resizer. |
613 window_resizer_.reset(); | 616 window_resizer_.reset(); |
614 | 617 |
615 CompleteDrag(DRAG_REVERT); | 618 CompleteDrag(DRAG_REVERT); |
616 } | 619 } |
617 | 620 |
618 } // namespace ash | 621 } // namespace ash |
OLD | NEW |