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

Side by Side Diff: ui/chromeos/touch_exploration_controller.cc

Issue 330763007: Swipe Gestures for Accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gesture-vlogs
Patch Set: Added keyboard events and fixed nits Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ui/chromeos/touch_exploration_controller.h" 5 #include "ui/chromeos/touch_exploration_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "ui/aura/client/cursor_client.h" 9 #include "ui/aura/client/cursor_client.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 21 matching lines...) Expand all
32 // until all fingers are released. 32 // until all fingers are released.
33 const int kTouchIdNone = -1; 33 const int kTouchIdNone = -1;
34 } // namespace 34 } // namespace
35 35
36 TouchExplorationController::TouchExplorationController( 36 TouchExplorationController::TouchExplorationController(
37 aura::Window* root_window) 37 aura::Window* root_window)
38 : root_window_(root_window), 38 : root_window_(root_window),
39 initial_touch_id_passthrough_mapping_(kTouchIdUnassigned), 39 initial_touch_id_passthrough_mapping_(kTouchIdUnassigned),
40 state_(NO_FINGERS_DOWN), 40 state_(NO_FINGERS_DOWN),
41 event_handler_for_testing_(NULL), 41 event_handler_for_testing_(NULL),
42 gesture_provider_(this),
42 prev_state_(NO_FINGERS_DOWN) { 43 prev_state_(NO_FINGERS_DOWN) {
43 CHECK(root_window); 44 CHECK(root_window);
44 root_window->GetHost()->GetEventSource()->AddEventRewriter(this); 45 root_window->GetHost()->GetEventSource()->AddEventRewriter(this);
45 } 46 }
46 47
47 TouchExplorationController::~TouchExplorationController() { 48 TouchExplorationController::~TouchExplorationController() {
48 root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this); 49 root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
49 } 50 }
50 51
51 void TouchExplorationController::CallTapTimerNowForTesting() { 52 void TouchExplorationController::CallTapTimerNowForTesting() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 case NO_FINGERS_DOWN: 121 case NO_FINGERS_DOWN:
121 return InNoFingersDown(touch_event, rewritten_event); 122 return InNoFingersDown(touch_event, rewritten_event);
122 case SINGLE_TAP_PRESSED: 123 case SINGLE_TAP_PRESSED:
123 return InSingleTapPressed(touch_event, rewritten_event); 124 return InSingleTapPressed(touch_event, rewritten_event);
124 case SINGLE_TAP_RELEASED: 125 case SINGLE_TAP_RELEASED:
125 return InSingleTapReleased(touch_event, rewritten_event); 126 return InSingleTapReleased(touch_event, rewritten_event);
126 case DOUBLE_TAP_PRESSED: 127 case DOUBLE_TAP_PRESSED:
127 return InDoubleTapPressed(touch_event, rewritten_event); 128 return InDoubleTapPressed(touch_event, rewritten_event);
128 case TOUCH_EXPLORATION: 129 case TOUCH_EXPLORATION:
129 return InTouchExploration(touch_event, rewritten_event); 130 return InTouchExploration(touch_event, rewritten_event);
131 case GESTURE_IN_PROGRESS:
132 return InGestureInProgress(touch_event, rewritten_event);
130 case PASSTHROUGH_MINUS_ONE: 133 case PASSTHROUGH_MINUS_ONE:
131 return InPassthroughMinusOne(touch_event, rewritten_event); 134 return InPassthroughMinusOne(touch_event, rewritten_event);
132 case TOUCH_EXPLORE_SECOND_PRESS: 135 case TOUCH_EXPLORE_SECOND_PRESS:
133 return InTouchExploreSecondPress(touch_event, rewritten_event); 136 return InTouchExploreSecondPress(touch_event, rewritten_event);
134 } 137 }
135 138
136 NOTREACHED(); 139 NOTREACHED();
137 return ui::EVENT_REWRITE_CONTINUE; 140 return ui::EVENT_REWRITE_CONTINUE;
138 } 141 }
139 142
140 ui::EventRewriteStatus TouchExplorationController::NextDispatchEvent( 143 ui::EventRewriteStatus TouchExplorationController::NextDispatchEvent(
141 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) { 144 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) {
142 NOTREACHED(); 145 NOTREACHED();
143 return ui::EVENT_REWRITE_CONTINUE; 146 return ui::EVENT_REWRITE_CONTINUE;
144 } 147 }
145 148
146 ui::EventRewriteStatus TouchExplorationController::InNoFingersDown( 149 ui::EventRewriteStatus TouchExplorationController::InNoFingersDown(
147 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { 150 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) {
148 const ui::EventType type = event.type(); 151 const ui::EventType type = event.type();
149 if (type == ui::ET_TOUCH_PRESSED) { 152 if (type == ui::ET_TOUCH_PRESSED) {
150 initial_press_.reset(new TouchEvent(event)); 153 initial_press_.reset(new TouchEvent(event));
151 tap_timer_.Start(FROM_HERE, 154 tap_timer_.Start(FROM_HERE,
152 gesture_detector_config_.double_tap_timeout, 155 gesture_detector_config_.double_tap_timeout,
153 this, 156 this,
154 &TouchExplorationController::OnTapTimerFired); 157 &TouchExplorationController::OnTapTimerFired);
158 gesture_provider_.OnTouchEvent(event);
159 gesture_provider_.OnTouchEventAck(false);
155 state_ = SINGLE_TAP_PRESSED; 160 state_ = SINGLE_TAP_PRESSED;
156 VLOG_STATE(); 161 VLOG_STATE();
157 return ui::EVENT_REWRITE_DISCARD; 162 return ui::EVENT_REWRITE_DISCARD;
158 } 163 }
159 164
160 NOTREACHED(); 165 NOTREACHED();
161 return ui::EVENT_REWRITE_CONTINUE; 166 return ui::EVENT_REWRITE_CONTINUE;
162 } 167 }
163 168
164 ui::EventRewriteStatus TouchExplorationController::InSingleTapPressed( 169 ui::EventRewriteStatus TouchExplorationController::InSingleTapPressed(
165 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { 170 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) {
166 const ui::EventType type = event.type(); 171 const ui::EventType type = event.type();
167 172
168 if (type == ui::ET_TOUCH_PRESSED) { 173 if (type == ui::ET_TOUCH_PRESSED) {
169 // Adding a second finger within the timeout period switches to 174 // Adding a second finger within the timeout period switches to
170 // passthrough. 175 // passthrough.
171 state_ = PASSTHROUGH_MINUS_ONE; 176 state_ = PASSTHROUGH_MINUS_ONE;
172 return InPassthroughMinusOne(event, rewritten_event); 177 return InPassthroughMinusOne(event, rewritten_event);
173 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { 178 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
174 DCHECK_EQ(0U, current_touch_ids_.size()); 179 DCHECK_EQ(0U, current_touch_ids_.size());
175 state_ = SINGLE_TAP_RELEASED; 180 state_ = SINGLE_TAP_RELEASED;
176 VLOG_STATE(); 181 VLOG_STATE();
177 return EVENT_REWRITE_DISCARD; 182 return EVENT_REWRITE_DISCARD;
178 } else if (type == ui::ET_TOUCH_MOVED) { 183 } else if (type == ui::ET_TOUCH_MOVED) {
179 // If the user moves far enough from the initial touch location (outside 184 float delta_time =
180 // the "slop" region, jump to the touch exploration mode early. 185 (event.time_stamp() - initial_press_->time_stamp()).InSecondsF();
181 // TODO(evy, lisayin): Add gesture recognition here instead - 186 float delta_distance =
182 // we should probably jump to gesture mode here if the velocity is 187 (event.location() - initial_press_->location()).Length();
183 // high enough, and touch exploration if the velocity is lower. 188 float velocity = delta_distance / delta_time;
184 float delta = (event.location() - initial_press_->location()).Length(); 189 VLOG(0) << "\n Delta time: " << delta_time
185 if (delta > gesture_detector_config_.touch_slop) { 190 << "\n Delta distance: " << delta_distance
186 EnterTouchToMouseMode(); 191 << "\n Velocity of click: " << velocity
187 state_ = TOUCH_EXPLORATION; 192 << "\n Minimum swipe velocity: "
188 VLOG_STATE(); 193 << gesture_detector_config_.minimum_swipe_velocity;
189 return InTouchExploration(event, rewritten_event); 194 if (delta_distance > gesture_detector_config_.touch_slop) {
195 // If the user moves fast enough and far enough
196 // from the initial touch location, start gesture detection
197 // Otherwise, if the user moves far enough from the initial touch location
198 // outside the "slop" region, jump to the touch exploration mode early.
199 if (velocity > gesture_detector_config_.minimum_swipe_velocity) {
200 state_ = GESTURE_IN_PROGRESS;
201 VLOG_STATE();
202 return InGestureInProgress(event, rewritten_event);
203 }
204 else {
205 EnterTouchToMouseMode();
206 state_ = TOUCH_EXPLORATION;
207 VLOG_STATE();
208 return InTouchExploration(event, rewritten_event);
209 }
190 } 210 }
191 211
192 return EVENT_REWRITE_DISCARD; 212 return EVENT_REWRITE_DISCARD;
193 } 213 }
194 NOTREACHED() << "Unexpected event type received."; 214 NOTREACHED() << "Unexpected event type received.";
195 return ui::EVENT_REWRITE_CONTINUE; 215 return ui::EVENT_REWRITE_CONTINUE;
196 } 216 }
197 217
198 ui::EventRewriteStatus TouchExplorationController::InSingleTapReleased( 218 ui::EventRewriteStatus TouchExplorationController::InSingleTapReleased(
199 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { 219 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 NOTREACHED() << "Unexpected event type received."; 296 NOTREACHED() << "Unexpected event type received.";
277 return ui::EVENT_REWRITE_CONTINUE; 297 return ui::EVENT_REWRITE_CONTINUE;
278 } 298 }
279 299
280 // Rewrite as a mouse-move event. 300 // Rewrite as a mouse-move event.
281 *rewritten_event = CreateMouseMoveEvent(event.location(), event.flags()); 301 *rewritten_event = CreateMouseMoveEvent(event.location(), event.flags());
282 last_touch_exploration_.reset(new TouchEvent(event)); 302 last_touch_exploration_.reset(new TouchEvent(event));
283 return ui::EVENT_REWRITE_REWRITTEN; 303 return ui::EVENT_REWRITE_REWRITTEN;
284 } 304 }
285 305
306 ui::EventRewriteStatus TouchExplorationController::InGestureInProgress(
307 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) {
308 ui::EventType type = event.type();
309 gfx::PointF location = event.location_f();
310 if (type == ui::ET_TOUCH_PRESSED ||
311 event.touch_id() != initial_press_->touch_id()) {
312 return EVENT_REWRITE_DISCARD;
313 }
314 if (type == ui::ET_TOUCH_MOVED) {
315 gesture_provider_.OnTouchEvent(event);
316 gesture_provider_.OnTouchEventAck(false);
317 }
318 if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
319 gesture_provider_.OnTouchEvent(event);
320 gesture_provider_.OnTouchEventAck(true);
321 if (current_touch_ids_.size() == 0)
322 ResetToNoFingersDown();
323 }
324 return ui::EVENT_REWRITE_DISCARD;
325 }
326
286 ui::EventRewriteStatus TouchExplorationController::InPassthroughMinusOne( 327 ui::EventRewriteStatus TouchExplorationController::InPassthroughMinusOne(
287 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { 328 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) {
288 ui::EventType type = event.type(); 329 ui::EventType type = event.type();
289 gfx::PointF location = event.location_f(); 330 gfx::PointF location = event.location_f();
290 331
291 if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { 332 if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
292 if (current_touch_ids_.size() == 0) 333 if (current_touch_ids_.size() == 0)
293 ResetToNoFingersDown(); 334 ResetToNoFingersDown();
294 335
295 if (initial_touch_id_passthrough_mapping_ == kTouchIdUnassigned) { 336 if (initial_touch_id_passthrough_mapping_ == kTouchIdUnassigned) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (current_touch_ids_.size() != 1) 400 if (current_touch_ids_.size() != 1)
360 return EVENT_REWRITE_DISCARD; 401 return EVENT_REWRITE_DISCARD;
361 402
362 // Rewrite at location of last touch exploration. 403 // Rewrite at location of last touch exploration.
363 rewritten_event->reset( 404 rewritten_event->reset(
364 new ui::TouchEvent(ui::ET_TOUCH_RELEASED, 405 new ui::TouchEvent(ui::ET_TOUCH_RELEASED,
365 last_touch_exploration_->location(), 406 last_touch_exploration_->location(),
366 initial_press_->touch_id(), 407 initial_press_->touch_id(),
367 event.time_stamp())); 408 event.time_stamp()));
368 (*rewritten_event)->set_flags(event.flags()); 409 (*rewritten_event)->set_flags(event.flags());
410 EnterTouchToMouseMode();
369 state_ = TOUCH_EXPLORATION; 411 state_ = TOUCH_EXPLORATION;
370 VLOG_STATE(); 412 VLOG_STATE();
371 return ui::EVENT_REWRITE_REWRITTEN; 413 return ui::EVENT_REWRITE_REWRITTEN;
372 } 414 }
373 NOTREACHED() << "Unexpected event type received."; 415 NOTREACHED() << "Unexpected event type received.";
374 return ui::EVENT_REWRITE_CONTINUE; 416 return ui::EVENT_REWRITE_CONTINUE;
375 } 417 }
376 418
377 void TouchExplorationController::OnTapTimerFired() { 419 void TouchExplorationController::OnTapTimerFired() {
378 if (state_ != SINGLE_TAP_RELEASED && state_ != SINGLE_TAP_PRESSED) 420 if (state_ != SINGLE_TAP_RELEASED &&
421 state_ != SINGLE_TAP_PRESSED &&
422 state_ != GESTURE_IN_PROGRESS)
379 return; 423 return;
380 424
381 if (state_ == SINGLE_TAP_RELEASED) { 425 if (state_ == SINGLE_TAP_RELEASED) {
382 ResetToNoFingersDown(); 426 ResetToNoFingersDown();
383 } else { 427 } else {
384 EnterTouchToMouseMode(); 428 EnterTouchToMouseMode();
429 // Discard any pending gestures.
430 delete gesture_provider_.GetAndResetPendingGestures();
385 state_ = TOUCH_EXPLORATION; 431 state_ = TOUCH_EXPLORATION;
386 VLOG_STATE(); 432 VLOG_STATE();
387 } 433 }
388 434
389 scoped_ptr<ui::Event> mouse_move = CreateMouseMoveEvent( 435 scoped_ptr<ui::Event> mouse_move = CreateMouseMoveEvent(
390 initial_press_->location(), initial_press_->flags()); 436 initial_press_->location(), initial_press_->flags());
391 DispatchEvent(mouse_move.get()); 437 DispatchEvent(mouse_move.get());
392 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); 438 last_touch_exploration_.reset(new TouchEvent(*initial_press_));
393 } 439 }
394 440
395 void TouchExplorationController::DispatchEvent(ui::Event* event) { 441 void TouchExplorationController::DispatchEvent(ui::Event* event) {
396 if (event_handler_for_testing_) { 442 if (event_handler_for_testing_) {
397 event_handler_for_testing_->OnEvent(event); 443 event_handler_for_testing_->OnEvent(event);
398 return; 444 return;
399 } 445 }
400 446
401 ui::EventDispatchDetails result ALLOW_UNUSED = 447 ui::EventDispatchDetails result ALLOW_UNUSED =
402 root_window_->GetHost()->dispatcher()->OnEventFromSource(event); 448 root_window_->GetHost()->dispatcher()->OnEventFromSource(event);
403 } 449 }
404 450
451 void TouchExplorationController::OnGestureEvent(ui::GestureEvent* gesture) {
452 CHECK(gesture->IsGestureEvent());
453 if (tap_timer_.IsRunning())
454 tap_timer_.Stop();
455 switch (gesture->type()) {
456 case ET_GESTURE_SWIPE:
457 VLOG(0) << " \n Gesture Triggered: " << gesture->name();
dmazzoni 2014/06/23 18:37:26 Want to log this no matter what the gesture?
458 OnSwipeEvent(gesture);
459 return;
460 default:
461 if (current_touch_ids_.size() != 0) {
462 EnterTouchToMouseMode();
463 state_ = TOUCH_EXPLORATION;
464 } else
465 ResetToNoFingersDown();
466 break;
467 }
468 }
469
470 void TouchExplorationController::OnSwipeEvent(ui::GestureEvent* swipe_gesture) {
471 // A swipe gesture contains details for the direction in which the swipe
472 // occurred.
473 GestureEventDetails event_details = swipe_gesture->details();
474 if (event_details.swipe_left()) {
475 DispatchShiftSearchKeyEvent(ui::VKEY_LEFT);
476 return;
477 } else if (event_details.swipe_right()) {
478 DispatchShiftSearchKeyEvent(ui::VKEY_RIGHT);
479 return;
480 } else if (event_details.swipe_up()) {
481 DispatchShiftSearchKeyEvent(ui::VKEY_UP);
482 return;
483 } else if (event_details.swipe_down()) {
484 DispatchShiftSearchKeyEvent(ui::VKEY_DOWN);
485 return;
486 }
487 }
488
489 void TouchExplorationController::DispatchShiftSearchKeyEvent(
490 const ui::KeyboardCode direction) {
491 // In order to activate the shortcut shift+search+<arrow key>
492 // three KeyPressed events must be dispatched in succession along
493 // with three KeyReleased events.
494 DispatchEvent(new ui::KeyEvent(
495 ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, ui::EF_SHIFT_DOWN, false));
496 // VKEY_LWIN is the search key on ChromeOS.
dmazzoni 2014/06/23 18:37:26 How about a constant at the top of the file: cons
497 DispatchEvent(new ui::KeyEvent(
498 ui::ET_KEY_PRESSED, ui::VKEY_LWIN, ui::EF_SHIFT_DOWN, false));
499 DispatchEvent(new ui::KeyEvent(
500 ui::ET_KEY_PRESSED, direction, ui::EF_SHIFT_DOWN, false));
501
502 DispatchEvent(new ui::KeyEvent(
503 ui::ET_KEY_RELEASED, direction, ui::EF_SHIFT_DOWN, false));
504 DispatchEvent(new ui::KeyEvent(
505 ui::ET_KEY_RELEASED, ui::VKEY_LWIN, ui::EF_SHIFT_DOWN, false));
506 DispatchEvent(new ui::KeyEvent(
507 ui::ET_KEY_RELEASED, ui::VKEY_SHIFT, ui::EF_NONE, false));
508 }
509
405 scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent( 510 scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent(
406 const gfx::PointF& location, 511 const gfx::PointF& location,
407 int flags) { 512 int flags) {
408 return scoped_ptr<ui::Event>( 513 return scoped_ptr<ui::Event>(
409 new ui::MouseEvent( 514 new ui::MouseEvent(
410 ui::ET_MOUSE_MOVED, 515 ui::ET_MOUSE_MOVED,
411 location, 516 location,
412 location, 517 location,
413 flags | ui::EF_IS_SYNTHESIZED | ui::EF_TOUCH_ACCESSIBILITY, 518 flags | ui::EF_IS_SYNTHESIZED | ui::EF_TOUCH_ACCESSIBILITY,
414 0)); 519 0));
415 } 520 }
416 521
417 void TouchExplorationController::EnterTouchToMouseMode() { 522 void TouchExplorationController::EnterTouchToMouseMode() {
418 aura::client::CursorClient* cursor_client = 523 aura::client::CursorClient* cursor_client =
419 aura::client::GetCursorClient(root_window_); 524 aura::client::GetCursorClient(root_window_);
420 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) 525 if (cursor_client && !cursor_client->IsMouseEventsEnabled())
421 cursor_client->EnableMouseEvents(); 526 cursor_client->EnableMouseEvents();
422 if (cursor_client && cursor_client->IsCursorVisible()) 527 if (cursor_client && cursor_client->IsCursorVisible())
423 cursor_client->HideCursor(); 528 cursor_client->HideCursor();
424 } 529 }
425 530
426 void TouchExplorationController::ResetToNoFingersDown() { 531 void TouchExplorationController::ResetToNoFingersDown() {
532 scoped_ptr<ScopedVector<ui::GestureEvent> > gestures;
533 gestures.reset(gesture_provider_.GetAndResetPendingGestures());
534 if (gestures != NULL) {
535 for (ScopedVector<GestureEvent>::iterator i = gestures->begin();
536 i != gestures->end();
537 ++i) {
538 OnGestureEvent(*i);
539 }
540 }
427 state_ = NO_FINGERS_DOWN; 541 state_ = NO_FINGERS_DOWN;
428 initial_touch_id_passthrough_mapping_ = kTouchIdUnassigned; 542 initial_touch_id_passthrough_mapping_ = kTouchIdUnassigned;
429 VLOG_STATE(); 543 VLOG_STATE();
430 if (tap_timer_.IsRunning()) 544 if (tap_timer_.IsRunning())
431 tap_timer_.Stop(); 545 tap_timer_.Stop();
432 } 546 }
433 547
434 void TouchExplorationController::VlogState(const char* function_name) { 548 void TouchExplorationController::VlogState(const char* function_name) {
435 if (prev_state_ == state_) 549 if (prev_state_ == state_)
436 return; 550 return;
(...skipping 26 matching lines...) Expand all
463 case NO_FINGERS_DOWN: 577 case NO_FINGERS_DOWN:
464 return "NO_FINGERS_DOWN"; 578 return "NO_FINGERS_DOWN";
465 case SINGLE_TAP_PRESSED: 579 case SINGLE_TAP_PRESSED:
466 return "SINGLE_TAP_PRESSED"; 580 return "SINGLE_TAP_PRESSED";
467 case SINGLE_TAP_RELEASED: 581 case SINGLE_TAP_RELEASED:
468 return "SINGLE_TAP_RELEASED"; 582 return "SINGLE_TAP_RELEASED";
469 case DOUBLE_TAP_PRESSED: 583 case DOUBLE_TAP_PRESSED:
470 return "DOUBLE_TAP_PRESSED"; 584 return "DOUBLE_TAP_PRESSED";
471 case TOUCH_EXPLORATION: 585 case TOUCH_EXPLORATION:
472 return "TOUCH_EXPLORATION"; 586 return "TOUCH_EXPLORATION";
587 case GESTURE_IN_PROGRESS:
588 return "GESTURE_IN_PROGRESS";
473 case PASSTHROUGH_MINUS_ONE: 589 case PASSTHROUGH_MINUS_ONE:
474 return "PASSTHROUGH_MINUS_ONE"; 590 return "PASSTHROUGH_MINUS_ONE";
475 case TOUCH_EXPLORE_SECOND_PRESS: 591 case TOUCH_EXPLORE_SECOND_PRESS:
476 return "TOUCH_EXPLORE_SECOND_PRESS"; 592 return "TOUCH_EXPLORE_SECOND_PRESS";
477 } 593 }
478 return "Not a state"; 594 return "Not a state";
479 } 595 }
480 596
481 std::string TouchExplorationController::EnumEventTypeToString( 597 std::string TouchExplorationController::EnumEventTypeToString(
482 ui::EventType type) { 598 ui::EventType type) {
483 // Add more cases later. For now, these are the most frequently seen 599 // Add more cases later. For now, these are the most frequently seen
484 // event types. 600 // event types.
485 switch (type) { 601 switch (type) {
486 case ET_TOUCH_RELEASED: 602 case ET_TOUCH_RELEASED:
487 return "ET_TOUCH_RELEASED"; 603 return "ET_TOUCH_RELEASED";
488 case ET_TOUCH_PRESSED: 604 case ET_TOUCH_PRESSED:
489 return "ET_TOUCH_PRESSED"; 605 return "ET_TOUCH_PRESSED";
490 case ET_TOUCH_MOVED: 606 case ET_TOUCH_MOVED:
491 return "ET_TOUCH_MOVED"; 607 return "ET_TOUCH_MOVED";
492 case ET_TOUCH_CANCELLED: 608 case ET_TOUCH_CANCELLED:
493 return "ET_TOUCH_CANCELLED"; 609 return "ET_TOUCH_CANCELLED";
494 default: 610 default:
495 return base::IntToString(type); 611 return base::IntToString(type);
496 } 612 }
497 } 613 }
498 614
499 } // namespace ui 615 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698