Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ash / wm / gestures / edge_gesture_handler.h
blob9eaa422d8db7f319fc8fb8cb2de3a99b3b7194c2
1 // Copyright (c) 2013 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.
5 #ifndef ASH_WM_GESTURES_EDGE_GESTURE_HANDLER_H_
6 #define ASH_WM_GESTURES_EDGE_GESTURE_HANDLER_H_
8 #include "ash/shelf/shelf_types.h"
9 #include "ash/wm/gestures/shelf_gesture_handler.h"
10 #include "base/basictypes.h"
12 namespace aura {
13 class Window;
16 namespace gfx {
17 class Point;
18 class Rect;
21 namespace ui {
22 class GestureEvent;
25 namespace ash {
26 namespace internal {
28 enum EdgeScrollOrientation {
29 EDGE_SCROLL_ORIENTATION_UNSET = 0,
30 EDGE_SCROLL_ORIENTATION_HORIZONTAL,
31 EDGE_SCROLL_ORIENTATION_VERTICAL
34 // Handles touch gestures that occur at the edge of the screen without the aid
35 // of a bezel sensor and might have actions associated with them.
36 class EdgeGestureHandler {
37 public:
38 EdgeGestureHandler();
39 virtual ~EdgeGestureHandler();
41 // Returns true of the gesture has been handled and it should not be processed
42 // any farther, false otherwise.
43 bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event);
45 private:
46 // Handle events meant for showing the launcher. Returns true when no further
47 // events from this gesture should be sent.
48 bool HandleLauncherControl(const ui::GestureEvent& event);
50 bool HandleEdgeGestureStart(aura::Window* target,
51 const ui::GestureEvent& event);
53 // Determine the gesture orientation (if not yet done).
54 // Returns true when the orientation has been successfully determined.
55 bool DetermineGestureOrientation(const ui::GestureEvent& event);
57 // Handles a gesture update once the orientation has been found.
58 bool HandleEdgeGestureUpdate(aura::Window* target,
59 const ui::GestureEvent& event);
61 bool HandleEdgeGestureEnd(aura::Window* target,
62 const ui::GestureEvent& event);
64 // Check that gesture starts near enough to the edge of the screen to be
65 // handled here. If so, set |start_location_| and return true, otherwise
66 // return false.
67 bool GestureStartInEdgeArea(const gfx::Rect& screen,
68 const ui::GestureEvent& event);
70 // Test if the gesture orientation makes sense to be dragging in or out the
71 // launcher.
72 bool IsGestureInLauncherOrientation(const ui::GestureEvent& event);
74 // Bit flags for which edges the gesture is close to. In the case that a
75 // gesture begins in a corner of the screen more then one flag may be set and
76 // the orientation of the gesture will be needed to disambiguate.
77 unsigned int start_location_;
79 // Orientation relative to the screen that the gesture is moving in
80 EdgeScrollOrientation orientation_;
81 ShelfGestureHandler shelf_handler_;
83 DISALLOW_COPY_AND_ASSIGN(EdgeGestureHandler);
86 } // namespace internal
87 } // namespace ash
89 #endif // ASH_WM_GESTURES_EDGE_GESTURE_HANDLER_H_