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

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

Issue 14195016: Add in gesture for immersive mode (Closed) Base URL: https://codereview.chromium.org/13315002/
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ 5 #ifndef ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
6 #define ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ 6 #define ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
7 7
8 8
9 9
10 #include <bitset> 10 #include <bitset>
(...skipping 28 matching lines...) Expand all
39 enum BorderLocation { 39 enum BorderLocation {
40 BORDER_LOCATION_BOTTOM = 0, 40 BORDER_LOCATION_BOTTOM = 0,
41 BORDER_LOCATION_LEFT = 1, 41 BORDER_LOCATION_LEFT = 1,
42 BORDER_LOCATION_TOP = 2, 42 BORDER_LOCATION_TOP = 2,
43 BORDER_LOCATION_RIGHT = 3, 43 BORDER_LOCATION_RIGHT = 3,
44 NUM_BORDER_LOCATIONS 44 NUM_BORDER_LOCATIONS
45 }; 45 };
46 46
47 typedef std::bitset<NUM_BORDER_LOCATIONS> BorderFlags; 47 typedef std::bitset<NUM_BORDER_LOCATIONS> BorderFlags;
48 48
49 enum BorderGestureType {
50 BORDER_GESTURE_TYPE_LAUNCHER,
51 BORDER_GESTURE_TYPE_IMMERSIVE,
52 BORDER_GESTURE_TYPE_UNKNOWN
53 };
54
49 // Handles touch gestures that occur around the border of the display area that 55 // Handles touch gestures that occur around the border of the display area that
50 // might have actions associated with them. It handles both gestures that 56 // might have actions associated with them. It handles both gestures that
51 // require a bezel sensor (bezel gestures) and those that do not (edge 57 // require a bezel sensor (bezel gestures) and those that do not (edge
52 // gestures). 58 // gestures).
53 class BorderGestureHandler { 59 class BorderGestureHandler {
54 public: 60 public:
55 BorderGestureHandler(); 61 BorderGestureHandler();
56 ~BorderGestureHandler(); 62 ~BorderGestureHandler();
57 63
58 // Returns true of the gesture has been handled and it should not be processed 64 // Returns true of the gesture has been handled and it should not be processed
59 // any farther, false otherwise. 65 // any farther, false otherwise.
60 bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event); 66 bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event);
61 67
62 private: 68 private:
63 // Handle events meant for showing the launcher. Returns true when no further 69 // Handle events meant for showing tabstrip in immersive mode. Returns true
64 // events from this gesture should be sent. 70 // when the event has been consumed, false otherwise.
71 bool HandleImmersiveControl(aura::Window* target,
72 const ui::GestureEvent& event);
73
74 // Handle events meant for showing the launcher. Returns true
75 // when the event has been consumed, false otherwise.
65 bool HandleLauncherControl(const ui::GestureEvent& event); 76 bool HandleLauncherControl(const ui::GestureEvent& event);
66 77
67 bool HandleBorderGestureStart(aura::Window* target, 78 bool HandleBorderGestureStart(aura::Window* target,
68 const ui::GestureEvent& event); 79 const ui::GestureEvent& event);
69 80
70 // Handles a gesture update once the orientation has been found. 81 // Handles a gesture update once the orientation has been found.
71 bool HandleBorderGestureUpdate(aura::Window* target, 82 bool HandleBorderGestureUpdate(aura::Window* target,
72 const ui::GestureEvent& event); 83 const ui::GestureEvent& event);
73 84
74 bool HandleBorderGestureEnd(aura::Window* target, 85 bool HandleBorderGestureEnd(aura::Window* target,
75 const ui::GestureEvent& event); 86 const ui::GestureEvent& event);
76 87
77 // Check that gesture starts on a bezel or in the edge region of the 88 // Check that gesture starts on a bezel or in the edge region of the
78 // screen. If so, set bits in |start_location_|. 89 // screen. If so, set bits in |start_location_|.
79 void GestureStartInTargetArea(const gfx::Rect& screen, 90 void GestureStartInTargetArea(const gfx::Rect& screen,
80 const ui::GestureEvent& event); 91 const ui::GestureEvent& event);
81 92
82 // Determine the gesture orientation (if not yet done). 93 // Determine the gesture orientation (if not yet done).
83 // Returns true when the orientation has been successfully determined. 94 // Returns true when the orientation has been successfully determined.
84 bool DetermineGestureOrientation(const ui::GestureEvent& event); 95 bool DetermineGestureOrientation(const ui::GestureEvent& event);
85 96
97 // Test if the gesture orientation makes sense to be trying to display the
98 // tabstrip in immersive mode.
99 bool IsGestureInImmersiveOrientation(const ui::GestureEvent& event);
100
86 // Test if the gesture orientation makes sense to be dragging in or out the 101 // Test if the gesture orientation makes sense to be dragging in or out the
87 // launcher. 102 // launcher.
88 bool IsGestureInLauncherOrientation(const ui::GestureEvent& event); 103 bool IsGestureInLauncherOrientation(const ui::GestureEvent& event);
89 104
90 // Which bezel/edges the gesture started in. In the case that a gesture begins 105 // Which bezel/edges the gesture started in. In the case that a gesture begins
91 // in a corner of the screen more then one flag may be set and the orientation 106 // in a corner of the screen more then one flag may be set and the orientation
92 // of the gesture will be needed to disambiguate. 107 // of the gesture will be needed to disambiguate.
93 BorderFlags start_location_; 108 BorderFlags start_location_;
94 109
95 // Orientation relative to the screen that the gesture is moving in 110 // Orientation relative to the screen that the gesture is moving in
96 BorderScrollOrientation orientation_; 111 BorderScrollOrientation orientation_;
97 112
113 // Allows tracking of current gesture type, so if a new one starts the handler
114 // can end the previous gesture
115 BorderGestureType gesture_type_;
sadrul 2013/04/19 01:41:20 It doesn't look like you are using gesture_type_?
rharrison 2013/04/22 18:36:52 This I think was left over cruft from something I
116
98 ShelfGestureHandler shelf_handler_; 117 ShelfGestureHandler shelf_handler_;
99 118
100 DISALLOW_COPY_AND_ASSIGN(BorderGestureHandler); 119 DISALLOW_COPY_AND_ASSIGN(BorderGestureHandler);
101 }; 120 };
102 121
103 } // namespace internal 122 } // namespace internal
104 } // namespace ash 123 } // namespace ash
105 #endif // ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_ 124 #endif // ASH_WM_GESTURES_BORDER_GESTURE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698