Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ash/wm/gestures/border_gesture_handler.h

Issue 15931005: Move bezel event routing for the shelf into ShelfLayoutManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed failing test after discussing with sadrul Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/wm/gestures/border_gesture_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
6 #define ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
7
8 #include <bitset>
9
10 #include "ash/shelf/shelf_types.h"
11 #include "ash/wm/gestures/shelf_gesture_handler.h"
12 #include "base/basictypes.h"
13
14 namespace aura {
15 class Window;
16 }
17
18 namespace gfx {
19 class Point;
20 class Rect;
21 }
22
23 namespace ui {
24 class GestureEvent;
25 }
26
27 namespace ash {
28 namespace internal {
29
30 enum BorderScrollOrientation {
31 BORDER_SCROLL_ORIENTATION_UNSET = 0,
32 BORDER_SCROLL_ORIENTATION_HORIZONTAL,
33 BORDER_SCROLL_ORIENTATION_VERTICAL
34 };
35
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
43 };
44
45 typedef std::bitset<NUM_BORDER_LOCATIONS> BorderFlags;
46
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();
55
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);
59
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);
64
65 bool HandleBorderGestureStart(aura::Window* target,
66 const ui::GestureEvent& event);
67
68 // Handles a gesture update once the orientation has been found.
69 bool HandleBorderGestureUpdate(aura::Window* target,
70 const ui::GestureEvent& event);
71
72 bool HandleBorderGestureEnd(aura::Window* target,
73 const ui::GestureEvent& event);
74
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);
79
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);
83
84 // Test if the gesture orientation makes sense to be dragging in or out the
85 // launcher.
86 bool IsGestureInLauncherOrientation(const ui::GestureEvent& event);
87
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_;
92
93 // Orientation relative to the screen that the gesture is moving in
94 BorderScrollOrientation orientation_;
95
96 ShelfGestureHandler shelf_handler_;
97
98 DISALLOW_COPY_AND_ASSIGN(BorderGestureHandler);
99 };
100
101 } // namespace internal
102 } // namespace ash
103 #endif // ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/wm/gestures/border_gesture_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698