| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MUS_MOVE_EVENT_HANDLER_H_ | 5 #ifndef ASH_MUS_MOVE_EVENT_HANDLER_H_ |
| 6 #define ASH_MUS_MOVE_EVENT_HANDLER_H_ | 6 #define ASH_MUS_MOVE_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/wm/wm_toplevel_window_event_handler.h" | 10 #include "ash/wm/wm_toplevel_window_event_handler.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
| 14 | 14 |
| 15 namespace aura { | 15 namespace aura { |
| 16 class Window; | 16 class Window; |
| 17 class WindowManagerClient; | 17 class WindowManagerClient; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 class CancelModeEvent; | 21 class CancelModeEvent; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 | 25 |
| 26 class WmWindow; | |
| 27 | |
| 28 namespace mus { | 26 namespace mus { |
| 29 | 27 |
| 30 class WorkspaceEventHandlerMus; | 28 class WorkspaceEventHandlerMus; |
| 31 | 29 |
| 32 // EventHandler attached to windows that may be dragged and/or resized. This | 30 // EventHandler attached to windows that may be dragged and/or resized. This |
| 33 // forwards to WmToplevelWindowEventHandler to handle the actual drag/resize. | 31 // forwards to WmToplevelWindowEventHandler to handle the actual drag/resize. |
| 34 // | 32 // |
| 35 // TODO(sky): rename this class to better reflect that it handles redirecting | 33 // TODO(sky): rename this class to better reflect that it handles redirecting |
| 36 // events in addition to drag. | 34 // events in addition to drag. |
| 37 class MoveEventHandler : public ui::EventHandler, public aura::WindowObserver { | 35 class MoveEventHandler : public ui::EventHandler, public aura::WindowObserver { |
| 38 public: | 36 public: |
| 39 MoveEventHandler(aura::WindowManagerClient* window_manager_client, | 37 MoveEventHandler(aura::WindowManagerClient* window_manager_client, |
| 40 aura::Window* window); | 38 aura::Window* window); |
| 41 ~MoveEventHandler() override; | 39 ~MoveEventHandler() override; |
| 42 | 40 |
| 43 // Retrieves the MoveEventHandler for an existing WmWindow. | 41 // Retrieves the MoveEventHandler for an existing aura::Window. |
| 44 static MoveEventHandler* GetForWindow(WmWindow* wm_window); | 42 static MoveEventHandler* GetForWindow(aura::Window* window); |
| 45 | 43 |
| 46 // Attempts to start a drag if one is not already in progress. This passes | 44 // Attempts to start a drag if one is not already in progress. This passes |
| 47 // the call to the underlying WmToplevelWindowEventHandler. After the drag | 45 // the call to the underlying WmToplevelWindowEventHandler. After the drag |
| 48 // completes, |end_closure| will be called to return whether the drag was | 46 // completes, |end_closure| will be called to return whether the drag was |
| 49 // successfully completed. | 47 // successfully completed. |
| 50 void AttemptToStartDrag( | 48 void AttemptToStartDrag( |
| 51 const gfx::Point& point_in_parent, | 49 const gfx::Point& point_in_parent, |
| 52 int window_component, | 50 int window_component, |
| 53 aura::client::WindowMoveSource source, | 51 aura::client::WindowMoveSource source, |
| 54 const base::Callback<void(bool success)>& end_closure); | 52 const base::Callback<void(bool success)>& end_closure); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 68 WorkspaceEventHandlerMus* GetWorkspaceEventHandlerMus(); | 66 WorkspaceEventHandlerMus* GetWorkspaceEventHandlerMus(); |
| 69 | 67 |
| 70 // Overridden from ui::EventHandler: | 68 // Overridden from ui::EventHandler: |
| 71 void OnMouseEvent(ui::MouseEvent* event) override; | 69 void OnMouseEvent(ui::MouseEvent* event) override; |
| 72 void OnGestureEvent(ui::GestureEvent* event) override; | 70 void OnGestureEvent(ui::GestureEvent* event) override; |
| 73 void OnCancelMode(ui::CancelModeEvent* event) override; | 71 void OnCancelMode(ui::CancelModeEvent* event) override; |
| 74 | 72 |
| 75 // Overridden from aura::WindowObserver: | 73 // Overridden from aura::WindowObserver: |
| 76 void OnWindowDestroying(aura::Window* window) override; | 74 void OnWindowDestroying(aura::Window* window) override; |
| 77 | 75 |
| 78 WmWindow* wm_window_; | 76 aura::Window* window_; |
| 79 aura::WindowManagerClient* window_manager_client_; | 77 aura::WindowManagerClient* window_manager_client_; |
| 80 wm::WmToplevelWindowEventHandler toplevel_window_event_handler_; | 78 wm::WmToplevelWindowEventHandler toplevel_window_event_handler_; |
| 81 | 79 |
| 82 DISALLOW_COPY_AND_ASSIGN(MoveEventHandler); | 80 DISALLOW_COPY_AND_ASSIGN(MoveEventHandler); |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 } // namespace mus | 83 } // namespace mus |
| 86 } // namespace ash | 84 } // namespace ash |
| 87 | 85 |
| 88 #endif // ASH_MUS_MOVE_EVENT_HANDLER_H_ | 86 #endif // ASH_MUS_MOVE_EVENT_HANDLER_H_ |
| OLD | NEW |