| 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 #ifndef ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ | 5 #ifndef ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
| 6 #define ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ | 6 #define ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class ASH_EXPORT ToplevelWindowEventHandler | 32 class ASH_EXPORT ToplevelWindowEventHandler |
| 33 : public ui::EventHandler, | 33 : public ui::EventHandler, |
| 34 public aura::client::WindowMoveClient, | 34 public aura::client::WindowMoveClient, |
| 35 public DisplayController::Observer { | 35 public DisplayController::Observer { |
| 36 public: | 36 public: |
| 37 explicit ToplevelWindowEventHandler(aura::Window* owner); | 37 explicit ToplevelWindowEventHandler(aura::Window* owner); |
| 38 virtual ~ToplevelWindowEventHandler(); | 38 virtual ~ToplevelWindowEventHandler(); |
| 39 | 39 |
| 40 // Overridden from ui::EventHandler: | 40 // Overridden from ui::EventHandler: |
| 41 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 41 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 42 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 42 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 44 | 44 |
| 45 // Overridden form aura::client::WindowMoveClient: | 45 // Overridden form aura::client::WindowMoveClient: |
| 46 virtual aura::client::WindowMoveResult RunMoveLoop( | 46 virtual aura::client::WindowMoveResult RunMoveLoop( |
| 47 aura::Window* source, | 47 aura::Window* source, |
| 48 const gfx::Vector2d& drag_offset) OVERRIDE; | 48 const gfx::Vector2d& drag_offset) OVERRIDE; |
| 49 virtual void EndMoveLoop() OVERRIDE; | 49 virtual void EndMoveLoop() OVERRIDE; |
| 50 | 50 |
| 51 // Overridden form ash::DisplayController::Observer: | 51 // Overridden form ash::DisplayController::Observer: |
| 52 virtual void OnDisplayConfigurationChanging() OVERRIDE; | 52 virtual void OnDisplayConfigurationChanging() OVERRIDE; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 class ScopedWindowResizer; | 55 class ScopedWindowResizer; |
| 56 | 56 |
| 57 enum DragCompletionStatus { | 57 enum DragCompletionStatus { |
| 58 DRAG_COMPLETE, | 58 DRAG_COMPLETE, |
| 59 DRAG_REVERT | 59 DRAG_REVERT |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 void CreateScopedWindowResizer(aura::Window* window, | 62 void CreateScopedWindowResizer(aura::Window* window, |
| 63 const gfx::Point& point_in_parent, | 63 const gfx::Point& point_in_parent, |
| 64 int window_component); | 64 int window_component); |
| 65 | 65 |
| 66 // Finishes the drag. | 66 // Finishes the drag. |
| 67 void CompleteDrag(DragCompletionStatus status, int event_flags); | 67 void CompleteDrag(DragCompletionStatus status, int event_flags); |
| 68 | 68 |
| 69 ui::EventResult HandleMousePressed(aura::Window* target, | 69 void HandleMousePressed(aura::Window* target, ui::MouseEvent* event); |
| 70 ui::MouseEvent* event); | 70 void HandleMouseReleased(aura::Window* target, ui::MouseEvent* event); |
| 71 ui::EventResult HandleMouseReleased(aura::Window* target, | |
| 72 ui::MouseEvent* event); | |
| 73 | 71 |
| 74 // Called during a drag to resize/position the window. | 72 // Called during a drag to resize/position the window. |
| 75 // The return value is returned by OnMouseEvent() above. | 73 // The return value is returned by OnMouseEvent() above. |
| 76 ui::EventResult HandleDrag(aura::Window* target, ui::LocatedEvent* event); | 74 void HandleDrag(aura::Window* target, ui::LocatedEvent* event); |
| 77 | 75 |
| 78 // Called during mouse moves to update window resize shadows. | 76 // Called during mouse moves to update window resize shadows. |
| 79 // Return value is returned by OnMouseEvent() above. | 77 // Return value is returned by OnMouseEvent() above. |
| 80 ui::EventResult HandleMouseMoved(aura::Window* target, | 78 void HandleMouseMoved(aura::Window* target, ui::LocatedEvent* event); |
| 81 ui::LocatedEvent* event); | |
| 82 | 79 |
| 83 // Called for mouse exits to hide window resize shadows. | 80 // Called for mouse exits to hide window resize shadows. |
| 84 // Return value is returned by OnMouseEvent() above. | 81 // Return value is returned by OnMouseEvent() above. |
| 85 ui::EventResult HandleMouseExited(aura::Window* target, | 82 void HandleMouseExited(aura::Window* target, ui::LocatedEvent* event); |
| 86 ui::LocatedEvent* event); | |
| 87 | 83 |
| 88 // Invoked from ScopedWindowResizer if the window is destroyed. | 84 // Invoked from ScopedWindowResizer if the window is destroyed. |
| 89 void ResizerWindowDestroyed(); | 85 void ResizerWindowDestroyed(); |
| 90 | 86 |
| 91 // Are we running a nested message loop from RunMoveLoop(). | 87 // Are we running a nested message loop from RunMoveLoop(). |
| 92 bool in_move_loop_; | 88 bool in_move_loop_; |
| 93 | 89 |
| 94 // Was the move operation cancelled? Used only when the nested loop | 90 // Was the move operation cancelled? Used only when the nested loop |
| 95 // is used to move a window. | 91 // is used to move a window. |
| 96 bool move_cancelled_; | 92 bool move_cancelled_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 111 // Used to track if this object is deleted while running a nested message | 107 // Used to track if this object is deleted while running a nested message |
| 112 // loop. If non-null the destructor sets this to true. | 108 // loop. If non-null the destructor sets this to true. |
| 113 bool* destroyed_; | 109 bool* destroyed_; |
| 114 | 110 |
| 115 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); | 111 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); |
| 116 }; | 112 }; |
| 117 | 113 |
| 118 } // namespace aura | 114 } // namespace aura |
| 119 | 115 |
| 120 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ | 116 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
| OLD | NEW |