| OLD | NEW |
| 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 "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 if (delta > gesture_detector_config_.touch_slop) { | 358 if (delta > gesture_detector_config_.touch_slop) { |
| 359 tap_timer_.Stop(); | 359 tap_timer_.Stop(); |
| 360 OnTapTimerFired(); | 360 OnTapTimerFired(); |
| 361 } | 361 } |
| 362 return EVENT_REWRITE_DISCARD; | 362 return EVENT_REWRITE_DISCARD; |
| 363 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 363 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
| 364 if (current_touch_ids_.size() != 0) | 364 if (current_touch_ids_.size() != 0) |
| 365 return EVENT_REWRITE_DISCARD; | 365 return EVENT_REWRITE_DISCARD; |
| 366 | 366 |
| 367 scoped_ptr<ui::TouchEvent> touch_press; | 367 scoped_ptr<ui::TouchEvent> touch_press; |
| 368 touch_press.reset(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 368 touch_press.reset(new ui::TouchEvent( |
| 369 last_touch_exploration_->location(), | 369 ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), |
| 370 initial_press_->touch_id(), | 370 initial_press_->touch_id(), event.time_stamp())); |
| 371 event.time_stamp())); | |
| 372 DispatchEvent(touch_press.get()); | 371 DispatchEvent(touch_press.get()); |
| 373 | 372 |
| 374 rewritten_event->reset( | 373 rewritten_event->reset(new ui::TouchEvent( |
| 375 new ui::TouchEvent(ui::ET_TOUCH_RELEASED, | 374 ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), |
| 376 last_touch_exploration_->location(), | 375 initial_press_->touch_id(), event.time_stamp())); |
| 377 initial_press_->touch_id(), | |
| 378 event.time_stamp())); | |
| 379 (*rewritten_event)->set_flags(event.flags()); | 376 (*rewritten_event)->set_flags(event.flags()); |
| 380 SET_STATE(NO_FINGERS_DOWN); | 377 SET_STATE(NO_FINGERS_DOWN); |
| 381 return ui::EVENT_REWRITE_REWRITTEN; | 378 return ui::EVENT_REWRITE_REWRITTEN; |
| 382 } | 379 } |
| 383 NOTREACHED(); | 380 NOTREACHED(); |
| 384 return ui::EVENT_REWRITE_CONTINUE; | 381 return ui::EVENT_REWRITE_CONTINUE; |
| 385 } | 382 } |
| 386 | 383 |
| 387 ui::EventRewriteStatus TouchExplorationController::InTouchReleasePending( | 384 ui::EventRewriteStatus TouchExplorationController::InTouchReleasePending( |
| 388 const ui::TouchEvent& event, | 385 const ui::TouchEvent& event, |
| 389 scoped_ptr<ui::Event>* rewritten_event) { | 386 scoped_ptr<ui::Event>* rewritten_event) { |
| 390 const ui::EventType type = event.type(); | 387 const ui::EventType type = event.type(); |
| 391 if (type == ui::ET_TOUCH_PRESSED || type == ui::ET_TOUCH_MOVED) { | 388 if (type == ui::ET_TOUCH_PRESSED || type == ui::ET_TOUCH_MOVED) { |
| 392 return ui::EVENT_REWRITE_DISCARD; | 389 return ui::EVENT_REWRITE_DISCARD; |
| 393 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 390 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
| 394 if (current_touch_ids_.size() != 0) | 391 if (current_touch_ids_.size() != 0) |
| 395 return EVENT_REWRITE_DISCARD; | 392 return EVENT_REWRITE_DISCARD; |
| 396 | 393 |
| 397 rewritten_event->reset( | 394 rewritten_event->reset(new ui::TouchEvent( |
| 398 new ui::TouchEvent(ui::ET_TOUCH_RELEASED, | 395 ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), |
| 399 last_touch_exploration_->location(), | 396 initial_press_->touch_id(), event.time_stamp())); |
| 400 initial_press_->touch_id(), | |
| 401 event.time_stamp())); | |
| 402 (*rewritten_event)->set_flags(event.flags()); | 397 (*rewritten_event)->set_flags(event.flags()); |
| 403 SET_STATE(NO_FINGERS_DOWN); | 398 SET_STATE(NO_FINGERS_DOWN); |
| 404 return ui::EVENT_REWRITE_REWRITTEN; | 399 return ui::EVENT_REWRITE_REWRITTEN; |
| 405 } | 400 } |
| 406 NOTREACHED(); | 401 NOTREACHED(); |
| 407 return ui::EVENT_REWRITE_CONTINUE; | 402 return ui::EVENT_REWRITE_CONTINUE; |
| 408 } | 403 } |
| 409 | 404 |
| 410 ui::EventRewriteStatus TouchExplorationController::InTouchExploration( | 405 ui::EventRewriteStatus TouchExplorationController::InTouchExploration( |
| 411 const ui::TouchEvent& event, | 406 const ui::TouchEvent& event, |
| 412 scoped_ptr<ui::Event>* rewritten_event) { | 407 scoped_ptr<ui::Event>* rewritten_event) { |
| 413 const ui::EventType type = event.type(); | 408 const ui::EventType type = event.type(); |
| 414 if (type == ui::ET_TOUCH_PRESSED) { | 409 if (type == ui::ET_TOUCH_PRESSED) { |
| 415 // Handle split-tap. | 410 // Handle split-tap. |
| 416 initial_press_.reset(new TouchEvent(event)); | 411 initial_press_.reset(new TouchEvent(event)); |
| 417 tap_timer_.Stop(); | 412 tap_timer_.Stop(); |
| 418 rewritten_event->reset( | 413 rewritten_event->reset(new ui::TouchEvent( |
| 419 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 414 ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), |
| 420 last_touch_exploration_->location(), | 415 event.touch_id(), event.time_stamp())); |
| 421 event.touch_id(), | |
| 422 event.time_stamp())); | |
| 423 (*rewritten_event)->set_flags(event.flags()); | 416 (*rewritten_event)->set_flags(event.flags()); |
| 424 SET_STATE(TOUCH_EXPLORE_SECOND_PRESS); | 417 SET_STATE(TOUCH_EXPLORE_SECOND_PRESS); |
| 425 return ui::EVENT_REWRITE_REWRITTEN; | 418 return ui::EVENT_REWRITE_REWRITTEN; |
| 426 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 419 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
| 427 initial_press_.reset(new TouchEvent(event)); | 420 initial_press_.reset(new TouchEvent(event)); |
| 428 StartTapTimer(); | 421 StartTapTimer(); |
| 429 SET_STATE(TOUCH_EXPLORE_RELEASED); | 422 SET_STATE(TOUCH_EXPLORE_RELEASED); |
| 430 } else if (type != ui::ET_TOUCH_MOVED) { | 423 } else if (type != ui::ET_TOUCH_MOVED) { |
| 431 NOTREACHED(); | 424 NOTREACHED(); |
| 432 return ui::EVENT_REWRITE_CONTINUE; | 425 return ui::EVENT_REWRITE_CONTINUE; |
| 433 } | 426 } |
| 434 | 427 |
| 435 // Rewrite as a mouse-move event. | 428 // Rewrite as a mouse-move event. |
| 436 *rewritten_event = CreateMouseMoveEvent(event.location(), event.flags()); | 429 *rewritten_event = CreateMouseMoveEvent(event.location_f(), event.flags()); |
| 437 last_touch_exploration_.reset(new TouchEvent(event)); | 430 last_touch_exploration_.reset(new TouchEvent(event)); |
| 438 return ui::EVENT_REWRITE_REWRITTEN; | 431 return ui::EVENT_REWRITE_REWRITTEN; |
| 439 } | 432 } |
| 440 | 433 |
| 441 ui::EventRewriteStatus TouchExplorationController::InGestureInProgress( | 434 ui::EventRewriteStatus TouchExplorationController::InGestureInProgress( |
| 442 const ui::TouchEvent& event, | 435 const ui::TouchEvent& event, |
| 443 scoped_ptr<ui::Event>* rewritten_event) { | 436 scoped_ptr<ui::Event>* rewritten_event) { |
| 444 // The events were sent to the gesture provider in RewriteEvent already. | 437 // The events were sent to the gesture provider in RewriteEvent already. |
| 445 // If no gesture is registered before the tap timer times out, the state | 438 // If no gesture is registered before the tap timer times out, the state |
| 446 // will change to "wait for no fingers down" or "touch exploration" depending | 439 // will change to "wait for no fingers down" or "touch exploration" depending |
| (...skipping 19 matching lines...) Expand all Loading... |
| 466 | 459 |
| 467 if (current_touch_ids_.size() == 0) { | 460 if (current_touch_ids_.size() == 0) { |
| 468 SET_STATE(NO_FINGERS_DOWN); | 461 SET_STATE(NO_FINGERS_DOWN); |
| 469 return ui::EVENT_REWRITE_DISCARD; | 462 return ui::EVENT_REWRITE_DISCARD; |
| 470 } | 463 } |
| 471 SET_STATE(WAIT_FOR_NO_FINGERS); | 464 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 472 return ui::EVENT_REWRITE_DISCARD; | 465 return ui::EVENT_REWRITE_DISCARD; |
| 473 } | 466 } |
| 474 | 467 |
| 475 rewritten_event->reset(new ui::TouchEvent( | 468 rewritten_event->reset(new ui::TouchEvent( |
| 476 type, event.location(), event.touch_id(), event.time_stamp())); | 469 type, event.location_f(), event.touch_id(), event.time_stamp())); |
| 477 (*rewritten_event)->set_flags(event.flags()); | 470 (*rewritten_event)->set_flags(event.flags()); |
| 478 | 471 |
| 479 if (current_touch_ids_.size() == 0) | 472 if (current_touch_ids_.size() == 0) |
| 480 SET_STATE(NO_FINGERS_DOWN); | 473 SET_STATE(NO_FINGERS_DOWN); |
| 481 | 474 |
| 482 return ui::EVENT_REWRITE_REWRITTEN; | 475 return ui::EVENT_REWRITE_REWRITTEN; |
| 483 } | 476 } |
| 484 | 477 |
| 485 ui::EventRewriteStatus TouchExplorationController::InOneFingerPassthrough( | 478 ui::EventRewriteStatus TouchExplorationController::InOneFingerPassthrough( |
| 486 const ui::TouchEvent& event, | 479 const ui::TouchEvent& event, |
| 487 scoped_ptr<ui::Event>* rewritten_event) { | 480 scoped_ptr<ui::Event>* rewritten_event) { |
| 488 if (event.touch_id() != initial_press_->touch_id()) { | 481 if (event.touch_id() != initial_press_->touch_id()) { |
| 489 if (current_touch_ids_.size() == 0) { | 482 if (current_touch_ids_.size() == 0) { |
| 490 SET_STATE(NO_FINGERS_DOWN); | 483 SET_STATE(NO_FINGERS_DOWN); |
| 491 } | 484 } |
| 492 return ui::EVENT_REWRITE_DISCARD; | 485 return ui::EVENT_REWRITE_DISCARD; |
| 493 } | 486 } |
| 494 rewritten_event->reset( | 487 rewritten_event->reset( |
| 495 new ui::TouchEvent(event.type(), | 488 new ui::TouchEvent(event.type(), event.location_f() - passthrough_offset_, |
| 496 event.location() - passthrough_offset_, | 489 event.touch_id(), event.time_stamp())); |
| 497 event.touch_id(), | |
| 498 event.time_stamp())); | |
| 499 | 490 |
| 500 (*rewritten_event)->set_flags(event.flags()); | 491 (*rewritten_event)->set_flags(event.flags()); |
| 501 if (current_touch_ids_.size() == 0) { | 492 if (current_touch_ids_.size() == 0) { |
| 502 SET_STATE(NO_FINGERS_DOWN); | 493 SET_STATE(NO_FINGERS_DOWN); |
| 503 } | 494 } |
| 504 return ui::EVENT_REWRITE_REWRITTEN; | 495 return ui::EVENT_REWRITE_REWRITTEN; |
| 505 } | 496 } |
| 506 | 497 |
| 507 ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress( | 498 ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress( |
| 508 const ui::TouchEvent& event, | 499 const ui::TouchEvent& event, |
| 509 scoped_ptr<ui::Event>* rewritten_event) { | 500 scoped_ptr<ui::Event>* rewritten_event) { |
| 510 ui::EventType type = event.type(); | 501 ui::EventType type = event.type(); |
| 511 gfx::PointF location = event.location_f(); | 502 gfx::PointF location = event.location_f(); |
| 512 if (type == ui::ET_TOUCH_PRESSED) { | 503 if (type == ui::ET_TOUCH_PRESSED) { |
| 513 // A third finger being pressed means that a split tap can no longer go | 504 // A third finger being pressed means that a split tap can no longer go |
| 514 // through. The user enters the wait state, Since there has already been | 505 // through. The user enters the wait state, Since there has already been |
| 515 // a press dispatched when split tap began, the touch needs to be | 506 // a press dispatched when split tap began, the touch needs to be |
| 516 // cancelled. | 507 // cancelled. |
| 517 rewritten_event->reset( | 508 rewritten_event->reset(new ui::TouchEvent( |
| 518 new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, | 509 ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(), |
| 519 last_touch_exploration_->location(), | 510 initial_press_->touch_id(), event.time_stamp())); |
| 520 initial_press_->touch_id(), | |
| 521 event.time_stamp())); | |
| 522 (*rewritten_event)->set_flags(event.flags()); | 511 (*rewritten_event)->set_flags(event.flags()); |
| 523 SET_STATE(WAIT_FOR_NO_FINGERS); | 512 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 524 return ui::EVENT_REWRITE_REWRITTEN; | 513 return ui::EVENT_REWRITE_REWRITTEN; |
| 525 } else if (type == ui::ET_TOUCH_MOVED) { | 514 } else if (type == ui::ET_TOUCH_MOVED) { |
| 526 // If the fingers have moved too far from their original locations, | 515 // If the fingers have moved too far from their original locations, |
| 527 // the user can no longer split tap. | 516 // the user can no longer split tap. |
| 528 ui::TouchEvent* original_touch; | 517 ui::TouchEvent* original_touch; |
| 529 if (event.touch_id() == last_touch_exploration_->touch_id()) { | 518 if (event.touch_id() == last_touch_exploration_->touch_id()) { |
| 530 original_touch = last_touch_exploration_.get(); | 519 original_touch = last_touch_exploration_.get(); |
| 531 } else if (event.touch_id() == initial_press_->touch_id()) { | 520 } else if (event.touch_id() == initial_press_->touch_id()) { |
| 532 original_touch = initial_press_.get(); | 521 original_touch = initial_press_.get(); |
| 533 } else { | 522 } else { |
| 534 NOTREACHED(); | 523 NOTREACHED(); |
| 535 SET_STATE(WAIT_FOR_NO_FINGERS); | 524 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 536 return ui::EVENT_REWRITE_DISCARD; | 525 return ui::EVENT_REWRITE_DISCARD; |
| 537 } | 526 } |
| 538 // Check the distance between the current finger location and the original | 527 // Check the distance between the current finger location and the original |
| 539 // location. The slop for this is a bit more generous since keeping two | 528 // location. The slop for this is a bit more generous since keeping two |
| 540 // fingers in place is a bit harder. If the user has left the slop, the | 529 // fingers in place is a bit harder. If the user has left the slop, the |
| 541 // split tap press (which was previous dispatched) is lifted with a touch | 530 // split tap press (which was previous dispatched) is lifted with a touch |
| 542 // cancelled, and the user enters the wait state. | 531 // cancelled, and the user enters the wait state. |
| 543 if ((event.location() - original_touch->location()).Length() > | 532 if ((event.location_f() - original_touch->location_f()).Length() > |
| 544 GetSplitTapTouchSlop()) { | 533 GetSplitTapTouchSlop()) { |
| 545 rewritten_event->reset( | 534 rewritten_event->reset(new ui::TouchEvent( |
| 546 new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, | 535 ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(), |
| 547 last_touch_exploration_->location(), | 536 initial_press_->touch_id(), event.time_stamp())); |
| 548 initial_press_->touch_id(), | |
| 549 event.time_stamp())); | |
| 550 (*rewritten_event)->set_flags(event.flags()); | 537 (*rewritten_event)->set_flags(event.flags()); |
| 551 SET_STATE(WAIT_FOR_NO_FINGERS); | 538 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 552 return ui::EVENT_REWRITE_REWRITTEN; | 539 return ui::EVENT_REWRITE_REWRITTEN; |
| 553 } | 540 } |
| 554 return ui::EVENT_REWRITE_DISCARD; | 541 return ui::EVENT_REWRITE_DISCARD; |
| 555 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 542 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
| 556 // If the touch exploration finger is lifted, there is no option to return | 543 // If the touch exploration finger is lifted, there is no option to return |
| 557 // to touch explore anymore. The remaining finger acts as a pending | 544 // to touch explore anymore. The remaining finger acts as a pending |
| 558 // tap or long tap for the last touch explore location. | 545 // tap or long tap for the last touch explore location. |
| 559 if (event.touch_id() == last_touch_exploration_->touch_id()) { | 546 if (event.touch_id() == last_touch_exploration_->touch_id()) { |
| 560 SET_STATE(TOUCH_RELEASE_PENDING); | 547 SET_STATE(TOUCH_RELEASE_PENDING); |
| 561 return EVENT_REWRITE_DISCARD; | 548 return EVENT_REWRITE_DISCARD; |
| 562 } | 549 } |
| 563 | 550 |
| 564 // Continue to release the touch only if the touch explore finger is the | 551 // Continue to release the touch only if the touch explore finger is the |
| 565 // only finger remaining. | 552 // only finger remaining. |
| 566 if (current_touch_ids_.size() != 1) | 553 if (current_touch_ids_.size() != 1) |
| 567 return EVENT_REWRITE_DISCARD; | 554 return EVENT_REWRITE_DISCARD; |
| 568 | 555 |
| 569 // Rewrite at location of last touch exploration. | 556 // Rewrite at location of last touch exploration. |
| 570 rewritten_event->reset( | 557 rewritten_event->reset(new ui::TouchEvent( |
| 571 new ui::TouchEvent(ui::ET_TOUCH_RELEASED, | 558 ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(), |
| 572 last_touch_exploration_->location(), | 559 initial_press_->touch_id(), event.time_stamp())); |
| 573 initial_press_->touch_id(), | |
| 574 event.time_stamp())); | |
| 575 (*rewritten_event)->set_flags(event.flags()); | 560 (*rewritten_event)->set_flags(event.flags()); |
| 576 SET_STATE(TOUCH_EXPLORATION); | 561 SET_STATE(TOUCH_EXPLORATION); |
| 577 EnterTouchToMouseMode(); | 562 EnterTouchToMouseMode(); |
| 578 return ui::EVENT_REWRITE_REWRITTEN; | 563 return ui::EVENT_REWRITE_REWRITTEN; |
| 579 } | 564 } |
| 580 NOTREACHED(); | 565 NOTREACHED(); |
| 581 return ui::EVENT_REWRITE_CONTINUE; | 566 return ui::EVENT_REWRITE_CONTINUE; |
| 582 } | 567 } |
| 583 | 568 |
| 584 ui::EventRewriteStatus TouchExplorationController::InWaitForNoFingers( | 569 ui::EventRewriteStatus TouchExplorationController::InWaitForNoFingers( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 switch (state_) { | 683 switch (state_) { |
| 699 case SINGLE_TAP_RELEASED: | 684 case SINGLE_TAP_RELEASED: |
| 700 SET_STATE(NO_FINGERS_DOWN); | 685 SET_STATE(NO_FINGERS_DOWN); |
| 701 break; | 686 break; |
| 702 case TOUCH_EXPLORE_RELEASED: | 687 case TOUCH_EXPLORE_RELEASED: |
| 703 SET_STATE(NO_FINGERS_DOWN); | 688 SET_STATE(NO_FINGERS_DOWN); |
| 704 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); | 689 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); |
| 705 return; | 690 return; |
| 706 case DOUBLE_TAP_PENDING: { | 691 case DOUBLE_TAP_PENDING: { |
| 707 SET_STATE(ONE_FINGER_PASSTHROUGH); | 692 SET_STATE(ONE_FINGER_PASSTHROUGH); |
| 708 passthrough_offset_ = last_unused_finger_event_->location() - | 693 passthrough_offset_ = last_unused_finger_event_->location_f() - |
| 709 last_touch_exploration_->location(); | 694 last_touch_exploration_->location_f(); |
| 710 scoped_ptr<ui::TouchEvent> passthrough_press( | 695 scoped_ptr<ui::TouchEvent> passthrough_press(new ui::TouchEvent( |
| 711 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 696 ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(), |
| 712 last_touch_exploration_->location(), | 697 last_unused_finger_event_->touch_id(), Now())); |
| 713 last_unused_finger_event_->touch_id(), | |
| 714 Now())); | |
| 715 DispatchEvent(passthrough_press.get()); | 698 DispatchEvent(passthrough_press.get()); |
| 716 return; | 699 return; |
| 717 } | 700 } |
| 718 case SINGLE_TAP_PRESSED: | 701 case SINGLE_TAP_PRESSED: |
| 719 if (passthrough_timer_.IsRunning()) | 702 if (passthrough_timer_.IsRunning()) |
| 720 return; | 703 return; |
| 721 case GESTURE_IN_PROGRESS: | 704 case GESTURE_IN_PROGRESS: |
| 722 // If only one finger is down, go into touch exploration. | 705 // If only one finger is down, go into touch exploration. |
| 723 if (current_touch_ids_.size() == 1) { | 706 if (current_touch_ids_.size() == 1) { |
| 724 EnterTouchToMouseMode(); | 707 EnterTouchToMouseMode(); |
| 725 SET_STATE(TOUCH_EXPLORATION); | 708 SET_STATE(TOUCH_EXPLORATION); |
| 726 break; | 709 break; |
| 727 } | 710 } |
| 728 // Otherwise wait for all fingers to be lifted. | 711 // Otherwise wait for all fingers to be lifted. |
| 729 SET_STATE(WAIT_FOR_NO_FINGERS); | 712 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 730 return; | 713 return; |
| 731 case TWO_FINGER_TAP: | 714 case TWO_FINGER_TAP: |
| 732 SET_STATE(WAIT_FOR_NO_FINGERS); | 715 SET_STATE(WAIT_FOR_NO_FINGERS); |
| 733 break; | 716 break; |
| 734 default: | 717 default: |
| 735 return; | 718 return; |
| 736 } | 719 } |
| 737 EnterTouchToMouseMode(); | 720 EnterTouchToMouseMode(); |
| 738 scoped_ptr<ui::Event> mouse_move = | 721 scoped_ptr<ui::Event> mouse_move = CreateMouseMoveEvent( |
| 739 CreateMouseMoveEvent(initial_press_->location(), initial_press_->flags()); | 722 initial_press_->location_f(), initial_press_->flags()); |
| 740 DispatchEvent(mouse_move.get()); | 723 DispatchEvent(mouse_move.get()); |
| 741 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); | 724 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); |
| 742 } | 725 } |
| 743 | 726 |
| 744 void TouchExplorationController::OnPassthroughTimerFired() { | 727 void TouchExplorationController::OnPassthroughTimerFired() { |
| 745 // The passthrough timer will only fire if if the user has held a finger in | 728 // The passthrough timer will only fire if if the user has held a finger in |
| 746 // one of the passthrough corners for the duration of the passthrough timeout. | 729 // one of the passthrough corners for the duration of the passthrough timeout. |
| 747 | 730 |
| 748 // Check that initial press isn't null. Also a check that if the initial | 731 // Check that initial press isn't null. Also a check that if the initial |
| 749 // corner press was released, then it should not be in corner passthrough. | 732 // corner press was released, then it should not be in corner passthrough. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 up_swipe_gestures_[4] = BindKeyEventWithFlags(VKEY_BROWSER_HOME, ui::EF_NONE); | 1127 up_swipe_gestures_[4] = BindKeyEventWithFlags(VKEY_BROWSER_HOME, ui::EF_NONE); |
| 1145 down_swipe_gestures_[4] = | 1128 down_swipe_gestures_[4] = |
| 1146 BindKeyEventWithFlags(VKEY_BROWSER_REFRESH, ui::EF_NONE); | 1129 BindKeyEventWithFlags(VKEY_BROWSER_REFRESH, ui::EF_NONE); |
| 1147 } | 1130 } |
| 1148 | 1131 |
| 1149 float TouchExplorationController::GetSplitTapTouchSlop() { | 1132 float TouchExplorationController::GetSplitTapTouchSlop() { |
| 1150 return gesture_detector_config_.touch_slop * 3; | 1133 return gesture_detector_config_.touch_slop * 3; |
| 1151 } | 1134 } |
| 1152 | 1135 |
| 1153 } // namespace ui | 1136 } // namespace ui |
| OLD | NEW |