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 3 // found in the LICENSE file. 4 5 #ifndef ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_ 6 #define ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "ui/aura/window_observer.h" 11 12 namespace aura { 13 class Window; 14 } 15 16 namespace ui { 17 class GestureEvent; 18 } 19 20 namespace ash { 21 22 class WindowResizer; 23 24 namespace internal { 25 26 // This handles 2-finger drag gestures to move toplevel windows. 27 class TwoFingerDragHandler : public aura::WindowObserver { 28 public: 29 TwoFingerDragHandler(); 30 virtual ~TwoFingerDragHandler(); 31 32 // Processes a gesture event and starts a drag, or updates/ends an in-progress 33 // drag. Returns true if the event has been handled and should not be 34 // processed any farther, false otherwise. 35 bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event); 36 37 private: 38 void Reset(aura::Window* window); 39 40 // Overridden from aura::WindowObserver. 41 virtual void OnWindowVisibilityChanged(aura::Window* window, 42 bool visible) OVERRIDE; 43 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 44 45 int first_finger_hittest_; 46 47 // Set to true while a drag initiated with two-finger gesture is in progress. 48 bool in_gesture_drag_; 49 50 scoped_ptr<WindowResizer> window_resizer_; 51 52 DISALLOW_COPY_AND_ASSIGN(TwoFingerDragHandler); 53 }; 54 55 } 56 } // namespace ash 57 58 #endif // ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_ 59