summaryrefslogtreecommitdiffstats
path: root/ash/wm/gestures/two_finger_drag_handler.h
blob: 11b7f51e5828b3f8e06fa71fa70dfc6c4d6bf572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_
#define ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/window_observer.h"

namespace aura {
class Window;
}

namespace ui {
class GestureEvent;
}

namespace ash {

class WindowResizer;

namespace internal {

// This handles 2-finger drag gestures to move toplevel windows.
class TwoFingerDragHandler : public aura::WindowObserver {
 public:
  TwoFingerDragHandler();
  virtual ~TwoFingerDragHandler();

  // Processes a gesture event and starts a drag, or updates/ends an in-progress
  // drag. Returns true if the event has been handled and should not be
  // processed any farther, false otherwise.
  bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event);

 private:
  void Reset(aura::Window* window);

  // Overridden from aura::WindowObserver.
  virtual void OnWindowVisibilityChanged(aura::Window* window,
                                         bool visible) OVERRIDE;
  virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;

  int first_finger_hittest_;

  // Set to true while a drag initiated with two-finger gesture is in progress.
  bool in_gesture_drag_;

  scoped_ptr<WindowResizer> window_resizer_;

  DISALLOW_COPY_AND_ASSIGN(TwoFingerDragHandler);
};

}
}  // namespace ash

#endif  // ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_