| 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 |
| 42 void PassResizer(ToplevelWindowEventHandler* window_handler); |
| 43 |
| 40 // Overridden from ui::EventHandler: | 44 // Overridden from ui::EventHandler: |
| 41 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 45 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 42 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 46 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 47 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 44 | 48 |
| 45 // Overridden form aura::client::WindowMoveClient: | 49 // Overridden form aura::client::WindowMoveClient: |
| 46 virtual aura::client::WindowMoveResult RunMoveLoop( | 50 virtual aura::client::WindowMoveResult RunMoveLoop( |
| 47 aura::Window* source, | 51 aura::Window* source, |
| 48 const gfx::Vector2d& drag_offset, | 52 const gfx::Vector2d& drag_offset, |
| 49 aura::client::WindowMoveSource move_source) OVERRIDE; | 53 aura::client::WindowMoveSource move_source) OVERRIDE; |
| 50 virtual void EndMoveLoop() OVERRIDE; | 54 virtual void EndMoveLoop() OVERRIDE; |
| 51 | 55 |
| 52 // Overridden form ash::DisplayController::Observer: | 56 // Overridden from ash::DisplayController::Observer: |
| 53 virtual void OnDisplayConfigurationChanging() OVERRIDE; | 57 virtual void OnDisplayConfigurationChanging() OVERRIDE; |
| 54 | 58 |
| 59 // Overridden from ash::WindowResizerOwner: |
| 60 virtual void PassResizer(WindowResizerOwner* new_owner) OVERRIDE; |
| 61 virtual void AcceptResizer(WindowResizer* resizer, |
| 62 bool in_gesture_drag) OVERRIDE; |
| 63 |
| 55 private: | 64 private: |
| 56 class ScopedWindowResizer; | 65 class ScopedWindowResizer; |
| 57 | 66 |
| 58 enum DragCompletionStatus { | 67 enum DragCompletionStatus { |
| 59 DRAG_COMPLETE, | 68 DRAG_COMPLETE, |
| 60 DRAG_REVERT | 69 DRAG_REVERT |
| 61 }; | 70 }; |
| 62 | 71 |
| 63 void CreateScopedWindowResizer(aura::Window* window, | 72 void CreateScopedWindowResizer(aura::Window* window, |
| 64 const gfx::Point& point_in_parent, | 73 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 | 117 // Used to track if this object is deleted while running a nested message |
| 109 // loop. If non-null the destructor sets this to true. | 118 // loop. If non-null the destructor sets this to true. |
| 110 bool* destroyed_; | 119 bool* destroyed_; |
| 111 | 120 |
| 112 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); | 121 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); |
| 113 }; | 122 }; |
| 114 | 123 |
| 115 } // namespace aura | 124 } // namespace aura |
| 116 | 125 |
| 117 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ | 126 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
| OLD | NEW |