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

Unified Diff: ui/chromeos/touch_exploration_controller.h

Issue 429633002: Added multi-finger gestures to touch_exploration_controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@passthrough
Patch Set: from the original branch Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/chromeos/touch_exploration_controller.h
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index 877163635795b1b376a574bd2e78a1cebce1f3a3..ab2a6a86b253c9ede10db5e5e5af8bf0368ba915 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -57,7 +57,9 @@ class TouchExplorationControllerDelegate {
// right would correspond to the keyboard short cut shift+search+right.
// When two or more fingers are pressed initially, from then on the events
// are passed through, but with the initial finger removed - so if you swipe
-// down with two fingers, the running app will see a one-finger swipe. Slide
+// down with two fingers, the running app will see a one-finger swipe. If the
+// user holds down the corner of the screen until an earcon sounds, all
mfomitchev 2014/08/06 16:11:49 What is the "earcon sound"? I don't see it mention
lisayin 2014/08/06 16:15:10 I think some of my changes might have accidentally
evy 2014/08/06 18:46:12 Whoops - thanks for catching that!
+// subsequent fingers will also be passed through in a similar manner. Slide
// gestures performed on the edge of the screen can change settings
// continuously. For example, sliding a finger along the right side of the
// screen will change the volume.
@@ -89,13 +91,13 @@ class TouchExplorationControllerDelegate {
// anywhere to activate it.
//
// The user can perform swipe gestures in one of the four cardinal directions
-// which will be interpreted and used to control the UI. The gesture will only
-// be registered if the finger moves outside the slop and completed within the
-// grace period. If additional fingers are added during the grace period, the
-// state changes to wait for those fingers to be released, and then goes to
-// touch exploration mode. If the gesture fails to be completed within the
-// grace period, the state changes to touch exploration mode. Once the state has
-// changed, any gestures made during the grace period are discarded.
+// which will be interpreted and used to control the UI. One finger gestures
+// will only be registered if the fingers move outside the slop, and all fingers
+// will only be registered if they are completed within the grace period. If a
+// single finger gesture fails to be completed within the grace period, the
+// state changes to touch exploration mode. If a multi finger gesture fails to
+// be completed within the grace period, the user must lift all fingers before
+// completing any more actions.
mfomitchev 2014/08/06 16:11:50 "user must lift all fingers before completing any
evy 2014/08/06 18:46:12 The first comment is right - the passthrough comme
//
// If the user double-taps, the second tap is passed through, allowing the
// user to click - however, the double-tap location is changed to the location
@@ -171,15 +173,13 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
ui::EventRewriteStatus InTouchExploration(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
- ui::EventRewriteStatus InTwoToOneFinger(
- const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
ui::EventRewriteStatus InOneFingerPassthrough(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
ui::EventRewriteStatus InGestureInProgress(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
ui::EventRewriteStatus InTouchExploreSecondPress(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
- ui::EventRewriteStatus InWaitForOneFinger(
+ ui::EventRewriteStatus InWaitForNoFingers(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
ui::EventRewriteStatus InSlideGesture(
const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
@@ -212,9 +212,12 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
void SideSlideControl(ui::GestureEvent* gesture);
- // Dispatches the keyboard short cut Shift+Search+<arrow key>
+ // Dispatches the keyboard short cut Shift+Search+<key>
// outside the event rewritting flow.
- void DispatchShiftSearchKeyEvent(const ui::KeyboardCode direction);
+ void DispatchShiftSearchKeyEvent(const ui::KeyboardCode third_key);
+
+ // Dispatches a single key with the given flags.
+ void DispatchKeyWithFlags(const ui::KeyboardCode key, int flags);
scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location,
int flags);
@@ -305,10 +308,10 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// If the user added another finger in SINGLE_TAP_PRESSED, or if the user
// has multiple fingers fingers down in any other state between
// passthrough, touch exploration, and gestures, they must release
- // all fingers except before completing any more actions. This state is
+ // all fingers before completing any more actions. This state is
// generally useful for developing new features, because it creates a
// simple way to handle a dead end in user flow.
- WAIT_FOR_ONE_FINGER,
+ WAIT_FOR_NO_FINGERS,
// If the user is within the given bounds from an edge of the screen, not
// including corners, then the resulting movements will be interpreted as
@@ -338,6 +341,10 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// Gets enum name from integer value.
const char* EnumStateToString(State state);
+ // Maps each single/multi finger swipe to the function that dispatches
+ // the corresponding key events.
+ void InitializeSwipeGestureMaps();
+
aura::Window* root_window_;
// Handles volume control. Not owned.
@@ -368,7 +375,7 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// we send the passed-through tap to the location of this event.
scoped_ptr<ui::TouchEvent> last_touch_exploration_;
- // A timer to fire the mouse move event after the double-tap delay.
+ // A timer that fires after the double-tap delay.
base::OneShotTimer<TouchExplorationController> tap_timer_;
// A timer to fire an indicating sound when sliding to change volume.
@@ -398,6 +405,12 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// testing, this clock is set to the simulated clock and used.
base::TickClock* tick_clock_;
+ // Maps swipes with the resulting functions that dispatch key events.
+ std::map<int, base::Closure> left_swipe_gestures_;
+ std::map<int, base::Closure> right_swipe_gestures_;
+ std::map<int, base::Closure> up_swipe_gestures_;
+ std::map<int, base::Closure> down_swipe_gestures_;
+
DISALLOW_COPY_AND_ASSIGN(TouchExplorationController);
};
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.cc » ('j') | ui/chromeos/touch_exploration_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698