| 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 MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ | 5 #ifndef MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ |
| 6 #define MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ | 6 #define MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/wm/common/wm_toplevel_window_event_handler.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 12 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
| 13 | 14 |
| 14 namespace aura { | 15 namespace aura { |
| 15 class Window; | 16 class Window; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace mus { | 19 namespace mus { |
| 19 class Window; | 20 class Window; |
| 20 class WindowManagerClient; | 21 class WindowManagerClient; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace ui { | 24 namespace ui { |
| 24 class LocatedEvent; | 25 class CancelModeEvent; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace mash { | 28 namespace mash { |
| 28 namespace wm { | 29 namespace wm { |
| 29 | 30 |
| 30 class MoveLoop; | 31 class WmWindowMus; |
| 31 | 32 |
| 32 // EventHandler attached to the root. Starts a MoveLoop as necessary. | 33 // EventHandler attached to windows that may be dragged and/or resized. This |
| 34 // forwards to WmToplevelWindowEventHandler to handle the actual drag/resize. |
| 33 class MoveEventHandler : public ui::EventHandler, public aura::WindowObserver { | 35 class MoveEventHandler : public ui::EventHandler, public aura::WindowObserver { |
| 34 public: | 36 public: |
| 35 MoveEventHandler(mus::Window* mus_window, | 37 MoveEventHandler(mus::Window* mus_window, |
| 36 mus::WindowManagerClient* window_manager_client, | 38 mus::WindowManagerClient* window_manager_client, |
| 37 aura::Window* aura_window); | 39 aura::Window* aura_window); |
| 38 ~MoveEventHandler() override; | 40 ~MoveEventHandler() override; |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 void ProcessLocatedEvent(ui::LocatedEvent* event); | |
| 42 int GetNonClientComponentForEvent(const ui::LocatedEvent* event); | |
| 43 | |
| 44 // Removes observer and EventHandler installed on |root_window_|. | 43 // Removes observer and EventHandler installed on |root_window_|. |
| 45 void Detach(); | 44 void Detach(); |
| 46 | 45 |
| 47 // Overridden from ui::EventHandler: | 46 // Overridden from ui::EventHandler: |
| 48 void OnMouseEvent(ui::MouseEvent* event) override; | 47 void OnMouseEvent(ui::MouseEvent* event) override; |
| 49 void OnTouchEvent(ui::TouchEvent* event) override; | 48 void OnGestureEvent(ui::GestureEvent* event) override; |
| 50 void OnCancelMode(ui::CancelModeEvent* event) override; | 49 void OnCancelMode(ui::CancelModeEvent* event) override; |
| 51 | 50 |
| 52 // Overridden from aura::WindowObserver: | 51 // Overridden from aura::WindowObserver: |
| 53 void OnWindowDestroying(aura::Window* window) override; | 52 void OnWindowDestroying(aura::Window* window) override; |
| 54 | 53 |
| 55 mus::Window* mus_window_; | 54 WmWindowMus* wm_window_; |
| 56 mus::WindowManagerClient* window_manager_client_; | 55 mus::WindowManagerClient* window_manager_client_; |
| 57 aura::Window* aura_window_; | 56 // The root window of the aura::Window supplied to the constructor. |
| 57 // MoveEventHandler is added as a pre-target handler (and observer) of this. |
| 58 aura::Window* root_window_; | 58 aura::Window* root_window_; |
| 59 std::unique_ptr<MoveLoop> move_loop_; | 59 ash::wm::WmToplevelWindowEventHandler toplevel_window_event_handler_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(MoveEventHandler); | 61 DISALLOW_COPY_AND_ASSIGN(MoveEventHandler); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace wm | 64 } // namespace wm |
| 65 } // namespace mash | 65 } // namespace mash |
| 66 | 66 |
| 67 #endif // MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ | 67 #endif // MASH_WM_FRAME_MOVE_EVENT_HANDLER_H_ |
| OLD | NEW |