| 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" |
| 11 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
| 12 #include "ash/wm/window_resizer_owner.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/aura/client/window_move_client.h" | 16 #include "ui/aura/client/window_move_client.h" |
| 16 #include "ui/base/events/event_handler.h" | 17 #include "ui/base/events/event_handler.h" |
| 17 #include "ui/gfx/point.h" | 18 #include "ui/gfx/point.h" |
| 18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 19 | 20 |
| 20 namespace aura { | 21 namespace aura { |
| 21 class Window; | 22 class Window; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace ui { | 25 namespace ui { |
| 25 class LocatedEvent; | 26 class LocatedEvent; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace ash { | 29 namespace ash { |
| 29 | 30 |
| 30 class WindowResizer; | 31 class WindowResizer; |
| 31 | 32 |
| 32 class ASH_EXPORT ToplevelWindowEventHandler | 33 class ASH_EXPORT ToplevelWindowEventHandler |
| 33 : public ui::EventHandler, | 34 : public ui::EventHandler, |
| 34 public aura::client::WindowMoveClient, | 35 public aura::client::WindowMoveClient, |
| 35 public DisplayController::Observer { | 36 public DisplayController::Observer, |
| 37 public WindowResizerOwner { |
| 36 public: | 38 public: |
| 37 explicit ToplevelWindowEventHandler(aura::Window* owner); | 39 explicit ToplevelWindowEventHandler(aura::Window* owner); |
| 38 virtual ~ToplevelWindowEventHandler(); | 40 virtual ~ToplevelWindowEventHandler(); |
| 39 | 41 |
| 40 // Overridden from ui::EventHandler: | 42 // Overridden from ui::EventHandler: |
| 41 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 43 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 42 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 44 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 45 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 44 | 46 |
| 45 // Overridden form aura::client::WindowMoveClient: | 47 // Overridden form aura::client::WindowMoveClient: |
| 46 virtual aura::client::WindowMoveResult RunMoveLoop( | 48 virtual aura::client::WindowMoveResult RunMoveLoop( |
| 47 aura::Window* source, | 49 aura::Window* source, |
| 48 const gfx::Vector2d& drag_offset, | 50 const gfx::Vector2d& drag_offset, |
| 49 aura::client::WindowMoveSource move_source) OVERRIDE; | 51 aura::client::WindowMoveSource move_source) OVERRIDE; |
| 50 virtual void EndMoveLoop() OVERRIDE; | 52 virtual void EndMoveLoop() OVERRIDE; |
| 51 | 53 |
| 52 // Overridden form ash::DisplayController::Observer: | 54 // Overridden from ash::DisplayController::Observer: |
| 53 virtual void OnDisplayConfigurationChanging() OVERRIDE; | 55 virtual void OnDisplayConfigurationChanging() OVERRIDE; |
| 54 | 56 |
| 57 // Overridden from ash::WindowResizerOwner: |
| 58 virtual void PassResizer(WindowResizerOwner* new_owner) OVERRIDE; |
| 59 virtual void AcceptResizer(WindowResizer* resizer, |
| 60 bool in_gesture_drag) OVERRIDE; |
| 61 |
| 55 private: | 62 private: |
| 56 class ScopedWindowResizer; | 63 class ScopedWindowResizer; |
| 57 | 64 |
| 58 enum DragCompletionStatus { | 65 enum DragCompletionStatus { |
| 59 DRAG_COMPLETE, | 66 DRAG_COMPLETE, |
| 60 DRAG_REVERT | 67 DRAG_REVERT |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 void CreateScopedWindowResizer(aura::Window* window, | 70 void CreateScopedWindowResizer(aura::Window* window, |
| 64 const gfx::Point& point_in_parent, | 71 const gfx::Point& point_in_parent, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Used to track if this object is deleted while running a nested message | 115 // Used to track if this object is deleted while running a nested message |
| 109 // loop. If non-null the destructor sets this to true. | 116 // loop. If non-null the destructor sets this to true. |
| 110 bool* destroyed_; | 117 bool* destroyed_; |
| 111 | 118 |
| 112 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); | 119 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); |
| 113 }; | 120 }; |
| 114 | 121 |
| 115 } // namespace aura | 122 } // namespace aura |
| 116 | 123 |
| 117 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ | 124 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
| OLD | NEW |