Only fsync leveldb's directory when the manifest is being updated.
[chromium-blink-merge.git] / ash / wm / gestures / border_gesture_handler.h
blobfe188f287d56ce60d7b0d1e76b614d966cc9e025
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_BORDER_GESTURE_HANDLER_H_
6 #define ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
8 #include <bitset>
10 #include "ash/shelf/shelf_types.h"
11 #include "ash/wm/gestures/shelf_gesture_handler.h"
12 #include "base/basictypes.h"
14 namespace aura {
15 class Window;
18 namespace gfx {
19 class Point;
20 class Rect;
23 namespace ui {
24 class GestureEvent;
27 namespace ash {
28 namespace internal {
30 enum BorderScrollOrientation {
31 BORDER_SCROLL_ORIENTATION_UNSET = 0,
32 BORDER_SCROLL_ORIENTATION_HORIZONTAL,
33 BORDER_SCROLL_ORIENTATION_VERTICAL
36 // Bit positions of border location flags
37 enum BorderLocation {
38 BORDER_LOCATION_BOTTOM = 0,
39 BORDER_LOCATION_LEFT = 1,
40 BORDER_LOCATION_TOP = 2,
41 BORDER_LOCATION_RIGHT = 3,
42 NUM_BORDER_LOCATIONS
45 typedef std::bitset<NUM_BORDER_LOCATIONS> BorderFlags;
47 // Handles touch gestures that occur around the border of the display area that
48 // might have actions associated with them. It handles both gestures that
49 // require a bezel sensor (bezel gestures) and those that do not (edge
50 // gestures).
51 class BorderGestureHandler {
52 public:
53 BorderGestureHandler();
54 ~BorderGestureHandler();
56 // Returns true of the gesture has been handled and it should not be processed
57 // any farther, false otherwise.
58 bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event);
60 private:
61 // Handle events meant for showing the launcher. Returns true when no further
62 // events from this gesture should be sent.
63 bool HandleLauncherControl(const ui::GestureEvent& event);
65 bool HandleBorderGestureStart(aura::Window* target,
66 const ui::GestureEvent& event);
68 // Handles a gesture update once the orientation has been found.
69 bool HandleBorderGestureUpdate(aura::Window* target,
70 const ui::GestureEvent& event);
72 bool HandleBorderGestureEnd(aura::Window* target,
73 const ui::GestureEvent& event);
75 // Check that gesture starts on a bezel or in the edge region of the
76 // screen. If so, set bits in |start_location_|.
77 void GestureStartInTargetArea(const gfx::Rect& screen,
78 const ui::GestureEvent& event);
80 // Determine the gesture orientation (if not yet done).
81 // Returns true when the orientation has been successfully determined.
82 bool DetermineGestureOrientation(const ui::GestureEvent& event);
84 // Test if the gesture orientation makes sense to be dragging in or out the
85 // launcher.
86 bool IsGestureInLauncherOrientation(const ui::GestureEvent& event);
88 // Which bezel/edges the gesture started in. In the case that a gesture begins
89 // in a corner of the screen more then one flag may be set and the orientation
90 // of the gesture will be needed to disambiguate.
91 BorderFlags start_location_;
93 // Orientation relative to the screen that the gesture is moving in
94 BorderScrollOrientation orientation_;
96 ShelfGestureHandler shelf_handler_;
98 DISALLOW_COPY_AND_ASSIGN(BorderGestureHandler);
101 } // namespace internal
102 } // namespace ash
103 #endif // ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_