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

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

Issue 407073008: Revert 284819 because it introduces leaks in TestingBoundaries and (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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
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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
8 #include "ui/aura/client/cursor_client.h" 9 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
11 #include "ui/aura/window_tree_host.h" 12 #include "ui/aura/window_tree_host.h"
12 #include "ui/events/event.h" 13 #include "ui/events/event.h"
13 #include "ui/events/event_processor.h" 14 #include "ui/events/event_processor.h"
14 #include "ui/gfx/geometry/rect.h"
15 15
16 #define VLOG_STATE() if (VLOG_IS_ON(0)) VlogState(__func__) 16 #define VLOG_STATE() if (VLOG_IS_ON(0)) VlogState(__func__)
17 #define VLOG_EVENT(event) if (VLOG_IS_ON(0)) VlogEvent(event, __func__) 17 #define VLOG_EVENT(event) if (VLOG_IS_ON(0)) VlogEvent(event, __func__)
18 18
19 namespace ui { 19 namespace ui {
20 20
21 namespace { 21 namespace {
22
23 // Delay between adjustment sounds.
24 const base::TimeDelta kSoundDelay = base::TimeDelta::FromMilliseconds(150);
25
26 // In ChromeOS, VKEY_LWIN is synonymous for the search key. 22 // In ChromeOS, VKEY_LWIN is synonymous for the search key.
27 const ui::KeyboardCode kChromeOSSearchKey = ui::VKEY_LWIN; 23 const ui::KeyboardCode kChromeOSSearchKey = ui::VKEY_LWIN;
28 } // namespace 24 } // namespace
29 25
30 TouchExplorationController::TouchExplorationController( 26 TouchExplorationController::TouchExplorationController(
31 aura::Window* root_window, 27 aura::Window* root_window)
32 TouchExplorationControllerDelegate* delegate)
33 : root_window_(root_window), 28 : root_window_(root_window),
34 delegate_(delegate),
35 state_(NO_FINGERS_DOWN), 29 state_(NO_FINGERS_DOWN),
36 event_handler_for_testing_(NULL), 30 event_handler_for_testing_(NULL),
37 gesture_provider_(this), 31 gesture_provider_(this),
38 prev_state_(NO_FINGERS_DOWN), 32 prev_state_(NO_FINGERS_DOWN),
39 VLOG_on_(true) { 33 VLOG_on_(true) {
40 CHECK(root_window); 34 CHECK(root_window);
41 root_window->GetHost()->GetEventSource()->AddEventRewriter(this); 35 root_window->GetHost()->GetEventSource()->AddEventRewriter(this);
42 } 36 }
43 37
44 TouchExplorationController::~TouchExplorationController() { 38 TouchExplorationController::~TouchExplorationController() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const ui::EventType type = touch_event.type(); 70 const ui::EventType type = touch_event.type();
77 const gfx::PointF& location = touch_event.location_f(); 71 const gfx::PointF& location = touch_event.location_f();
78 const int touch_id = touch_event.touch_id(); 72 const int touch_id = touch_event.touch_id();
79 73
80 // Always update touch ids and touch locations, so we can use those 74 // Always update touch ids and touch locations, so we can use those
81 // no matter what state we're in. 75 // no matter what state we're in.
82 if (type == ui::ET_TOUCH_PRESSED) { 76 if (type == ui::ET_TOUCH_PRESSED) {
83 current_touch_ids_.push_back(touch_id); 77 current_touch_ids_.push_back(touch_id);
84 touch_locations_.insert(std::pair<int, gfx::PointF>(touch_id, location)); 78 touch_locations_.insert(std::pair<int, gfx::PointF>(touch_id, location));
85 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { 79 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
86 // In order to avoid accidentally double tapping when moving off the edge of
87 // the screen, the state will be rewritten to NoFingersDown.
88 TouchEvent touch_event = static_cast<const TouchEvent&>(event);
89 if (FindEdgesWithinBounds(touch_event.location(), kLeavingScreenEdge) !=
90 NO_EDGE) {
91 if (current_touch_ids_.size() == 0)
92 ResetToNoFingersDown();
93 }
94
95 std::vector<int>::iterator it = std::find( 80 std::vector<int>::iterator it = std::find(
96 current_touch_ids_.begin(), current_touch_ids_.end(), touch_id); 81 current_touch_ids_.begin(), current_touch_ids_.end(), touch_id);
97 82
98 // Can happen if touch exploration is enabled while fingers were down. 83 // Can happen if touch exploration is enabled while fingers were down.
99 if (it == current_touch_ids_.end()) 84 if (it == current_touch_ids_.end())
100 return ui::EVENT_REWRITE_CONTINUE; 85 return ui::EVENT_REWRITE_CONTINUE;
101 86
102 current_touch_ids_.erase(it); 87 current_touch_ids_.erase(it);
103 touch_locations_.erase(touch_id); 88 touch_locations_.erase(touch_id);
104 } else if (type == ui::ET_TOUCH_MOVED) { 89 } else if (type == ui::ET_TOUCH_MOVED) {
(...skipping 24 matching lines...) Expand all
129 case GESTURE_IN_PROGRESS: 114 case GESTURE_IN_PROGRESS:
130 return InGestureInProgress(touch_event, rewritten_event); 115 return InGestureInProgress(touch_event, rewritten_event);
131 case TOUCH_EXPLORE_SECOND_PRESS: 116 case TOUCH_EXPLORE_SECOND_PRESS:
132 return InTouchExploreSecondPress(touch_event, rewritten_event); 117 return InTouchExploreSecondPress(touch_event, rewritten_event);
133 case TWO_TO_ONE_FINGER: 118 case TWO_TO_ONE_FINGER:
134 return InTwoToOneFinger(touch_event, rewritten_event); 119 return InTwoToOneFinger(touch_event, rewritten_event);
135 case PASSTHROUGH: 120 case PASSTHROUGH:
136 return InPassthrough(touch_event, rewritten_event); 121 return InPassthrough(touch_event, rewritten_event);
137 case WAIT_FOR_RELEASE: 122 case WAIT_FOR_RELEASE:
138 return InWaitForRelease(touch_event, rewritten_event); 123 return InWaitForRelease(touch_event, rewritten_event);
139 case SLIDE_GESTURE:
140 return InSlideGesture(touch_event, rewritten_event);
141 } 124 }
142 NOTREACHED(); 125 NOTREACHED();
143 return ui::EVENT_REWRITE_CONTINUE; 126 return ui::EVENT_REWRITE_CONTINUE;
144 } 127 }
145 128
146 ui::EventRewriteStatus TouchExplorationController::NextDispatchEvent( 129 ui::EventRewriteStatus TouchExplorationController::NextDispatchEvent(
147 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) { 130 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) {
148 NOTREACHED(); 131 NOTREACHED();
149 return ui::EVENT_REWRITE_CONTINUE; 132 return ui::EVENT_REWRITE_CONTINUE;
150 } 133 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 184
202 float delta_time = 185 float delta_time =
203 (event.time_stamp() - initial_press_->time_stamp()).InSecondsF(); 186 (event.time_stamp() - initial_press_->time_stamp()).InSecondsF();
204 float velocity = distance / delta_time; 187 float velocity = distance / delta_time;
205 VLOG(0) << "\n Delta time: " << delta_time 188 VLOG(0) << "\n Delta time: " << delta_time
206 << "\n Distance: " << distance 189 << "\n Distance: " << distance
207 << "\n Velocity of click: " << velocity 190 << "\n Velocity of click: " << velocity
208 << "\n Minimum swipe velocity: " 191 << "\n Minimum swipe velocity: "
209 << gesture_detector_config_.minimum_swipe_velocity; 192 << gesture_detector_config_.minimum_swipe_velocity;
210 193
211 // Change to slide gesture if the slide occurred at the right edge.
212 int edge = FindEdgesWithinBounds(event.location(), kMaxDistanceFromEdge);
213 if (edge & RIGHT_EDGE) {
214 state_ = SLIDE_GESTURE;
215 VLOG_STATE();
216 return InSlideGesture(event, rewritten_event);
217 }
218
219 // If the user moves fast enough from the initial touch location, start 194 // If the user moves fast enough from the initial touch location, start
220 // gesture detection. Otherwise, jump to the touch exploration mode early. 195 // gesture detection. Otherwise, jump to the touch exploration mode early.
221 if (velocity > gesture_detector_config_.minimum_swipe_velocity) { 196 if (velocity > gesture_detector_config_.minimum_swipe_velocity) {
222 state_ = GESTURE_IN_PROGRESS; 197 state_ = GESTURE_IN_PROGRESS;
223 VLOG_STATE(); 198 VLOG_STATE();
224 return InGestureInProgress(event, rewritten_event); 199 return InGestureInProgress(event, rewritten_event);
225 } 200 }
226 EnterTouchToMouseMode(); 201 EnterTouchToMouseMode();
227 state_ = TOUCH_EXPLORATION; 202 state_ = TOUCH_EXPLORATION;
228 VLOG_STATE(); 203 VLOG_STATE();
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return ui::EVENT_REWRITE_CONTINUE; 490 return ui::EVENT_REWRITE_CONTINUE;
516 } 491 }
517 if (current_touch_ids_.size() == 0) { 492 if (current_touch_ids_.size() == 0) {
518 state_ = NO_FINGERS_DOWN; 493 state_ = NO_FINGERS_DOWN;
519 VLOG_STATE(); 494 VLOG_STATE();
520 ResetToNoFingersDown(); 495 ResetToNoFingersDown();
521 } 496 }
522 return EVENT_REWRITE_DISCARD; 497 return EVENT_REWRITE_DISCARD;
523 } 498 }
524 499
525 void TouchExplorationController::PlaySoundForTimer() {
526 delegate_->PlayVolumeAdjustSound();
527 }
528
529 ui::EventRewriteStatus TouchExplorationController::InSlideGesture(
530 const ui::TouchEvent& event,
531 scoped_ptr<ui::Event>* rewritten_event) {
532 // The timer should not fire when sliding.
533 if (tap_timer_.IsRunning())
534 tap_timer_.Stop();
535
536 ui::EventType type = event.type();
537 // If additional fingers are added before a swipe gesture has been registered,
538 // then wait until all fingers have been lifted.
539 if (type == ui::ET_TOUCH_PRESSED ||
540 event.touch_id() != initial_press_->touch_id()) {
541 if (sound_timer_.IsRunning())
542 sound_timer_.Stop();
543 // Discard any pending gestures.
544 ignore_result(gesture_provider_.GetAndResetPendingGestures());
545 state_ = WAIT_FOR_RELEASE;
546 return EVENT_REWRITE_DISCARD;
547 }
548
549 // Allows user to return to the edge to adjust the sound if they have left the
550 // boundaries.
551 int edge = FindEdgesWithinBounds(event.location(), kSlopDistanceFromEdge);
552 if (!(edge & RIGHT_EDGE) && (type != ui::ET_TOUCH_RELEASED)) {
553 if (sound_timer_.IsRunning()) {
554 sound_timer_.Stop();
555 }
556 return EVENT_REWRITE_DISCARD;
557 }
558
559 // This can occur if the user leaves the screen edge and then returns to it to
560 // continue adjusting the sound.
561 if (!sound_timer_.IsRunning()) {
562 sound_timer_.Start(FROM_HERE,
563 kSoundDelay,
564 this,
565 &ui::TouchExplorationController::PlaySoundForTimer);
566 delegate_->PlayVolumeAdjustSound();
567 }
568
569 // There should not be more than one finger down.
570 DCHECK(current_touch_ids_.size() <= 1);
571 if (type == ui::ET_TOUCH_MOVED) {
572 gesture_provider_.OnTouchEvent(event);
573 gesture_provider_.OnTouchEventAck(false);
574 }
575 if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
576 gesture_provider_.OnTouchEvent(event);
577 gesture_provider_.OnTouchEventAck(false);
578 ignore_result(gesture_provider_.GetAndResetPendingGestures());
579 if (current_touch_ids_.size() == 0)
580 ResetToNoFingersDown();
581 return ui::EVENT_REWRITE_DISCARD;
582 }
583
584 ProcessGestureEvents();
585 return ui::EVENT_REWRITE_DISCARD;
586 }
587
588 void TouchExplorationController::OnTapTimerFired() { 500 void TouchExplorationController::OnTapTimerFired() {
589 switch (state_) { 501 switch (state_) {
590 case SINGLE_TAP_RELEASED: 502 case SINGLE_TAP_RELEASED:
591 ResetToNoFingersDown(); 503 ResetToNoFingersDown();
592 break; 504 break;
593 case TOUCH_EXPLORE_RELEASED: 505 case TOUCH_EXPLORE_RELEASED:
594 ResetToNoFingersDown(); 506 ResetToNoFingersDown();
595 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); 507 last_touch_exploration_.reset(new TouchEvent(*initial_press_));
596 return; 508 return;
597 case SINGLE_TAP_PRESSED: 509 case SINGLE_TAP_PRESSED:
598 case GESTURE_IN_PROGRESS: 510 case GESTURE_IN_PROGRESS:
599 // Discard any pending gestures. 511 // Discard any pending gestures.
600 ignore_result(gesture_provider_.GetAndResetPendingGestures()); 512 ignore_result(gesture_provider_.GetAndResetPendingGestures());
601 EnterTouchToMouseMode(); 513 EnterTouchToMouseMode();
602 state_ = TOUCH_EXPLORATION; 514 state_ = TOUCH_EXPLORATION;
603 VLOG_STATE(); 515 VLOG_STATE();
604 break; 516 break;
605 default: 517 default:
606 return; 518 return;
607 } 519 }
608 scoped_ptr<ui::Event> mouse_move = 520 scoped_ptr<ui::Event> mouse_move =
609 CreateMouseMoveEvent(initial_press_->location(), initial_press_->flags()); 521 CreateMouseMoveEvent(initial_press_->location(), initial_press_->flags());
610 DispatchEvent(mouse_move.get()); 522 DispatchEvent(mouse_move.get());
611 last_touch_exploration_.reset(new TouchEvent(*initial_press_)); 523 last_touch_exploration_.reset(new TouchEvent(*initial_press_));
612 } 524 }
613 525
614 void TouchExplorationController::DispatchEvent(ui::Event* event) { 526 void TouchExplorationController::DispatchEvent(ui::Event* event) {
615 if (event_handler_for_testing_) { 527 if (event_handler_for_testing_) {
616 event_handler_for_testing_->OnEvent(event); 528 event_handler_for_testing_->OnEvent(event);
617 return; 529 return;
618 } 530 }
619 ui::EventDispatchDetails result ALLOW_UNUSED = 531 ui::EventDispatchDetails result ALLOW_UNUSED =
620 root_window_->GetHost()->dispatcher()->OnEventFromSource(event); 532 root_window_->GetHost()->dispatcher()->OnEventFromSource(event);
621 } 533 }
622 534
623 void TouchExplorationController::OnGestureEvent( 535 void TouchExplorationController::OnGestureEvent(ui::GestureEvent* gesture) {
624 ui::GestureEvent* gesture) {
625 CHECK(gesture->IsGestureEvent()); 536 CHECK(gesture->IsGestureEvent());
626 ui::EventType type = gesture->type();
627 VLOG(0) << " \n Gesture Triggered: " << gesture->name(); 537 VLOG(0) << " \n Gesture Triggered: " << gesture->name();
628 if (type == ui::ET_GESTURE_SWIPE && state_ != SLIDE_GESTURE) { 538 if (gesture->type() == ui::ET_GESTURE_SWIPE) {
629 VLOG(0) << "Swipe!"; 539 if (tap_timer_.IsRunning())
630 ignore_result(gesture_provider_.GetAndResetPendingGestures()); 540 tap_timer_.Stop();
631 OnSwipeEvent(gesture); 541 OnSwipeEvent(gesture);
632 return; 542 return;
633 } 543 }
634 } 544 }
635 545
636 void TouchExplorationController::ProcessGestureEvents() { 546 void TouchExplorationController::ProcessGestureEvents() {
637 scoped_ptr<ScopedVector<ui::GestureEvent> > gestures( 547 scoped_ptr<ScopedVector<ui::GestureEvent> > gestures(
638 gesture_provider_.GetAndResetPendingGestures()); 548 gesture_provider_.GetAndResetPendingGestures());
639 if (gestures) { 549 if (gestures) {
640 for (ScopedVector<GestureEvent>::iterator i = gestures->begin(); 550 for (ScopedVector<GestureEvent>::iterator i = gestures->begin();
641 i != gestures->end(); 551 i != gestures->end();
642 ++i) { 552 ++i) {
643 if (state_ == SLIDE_GESTURE) 553 OnGestureEvent(*i);
644 SideSlideControl(*i);
645 else
646 OnGestureEvent(*i);
647 } 554 }
648 } 555 }
649 } 556 }
650 557
651 void TouchExplorationController::SideSlideControl(ui::GestureEvent* gesture) {
652 ui::EventType type = gesture->type();
653 if (!gesture->IsScrollGestureEvent())
654 return;
655
656 if (type == ET_GESTURE_SCROLL_BEGIN) {
657 delegate_->PlayVolumeAdjustSound();
658 }
659
660 if (type == ET_GESTURE_SCROLL_END) {
661 if (sound_timer_.IsRunning())
662 sound_timer_.Stop();
663 delegate_->PlayVolumeAdjustSound();
664 }
665
666 // If the user is in the corner of the right side of the screen, the volume
667 // will be automatically set to 100% or muted depending on which corner they
668 // are in. Otherwise, the user will be able to adjust the volume by sliding
669 // their finger along the right side of the screen. Volume is relative to
670 // where they are on the right side of the screen.
671 gfx::Point location = gesture->location();
672 int edge = FindEdgesWithinBounds(location, kSlopDistanceFromEdge);
673 if (!(edge & RIGHT_EDGE))
674 return;
675
676 if (edge & TOP_EDGE) {
677 delegate_->SetOutputLevel(100);
678 return;
679 }
680 if (edge & BOTTOM_EDGE) {
681 delegate_->SetOutputLevel(0);
682 return;
683 }
684
685 location = gesture->location();
686 root_window_->GetHost()->ConvertPointFromNativeScreen(&location);
687 float volume_adjust_height =
688 root_window_->bounds().height() - 2 * kMaxDistanceFromEdge;
689 float ratio = (location.y() - kMaxDistanceFromEdge) / volume_adjust_height;
690 float volume = 100 - 100 * ratio;
691 VLOG(0) << "\n Volume = " << volume << "\n Location = " << location.ToString()
692 << "\n Bounds = " << root_window_->bounds().right();
693
694 delegate_->SetOutputLevel(int(volume));
695 }
696
697
698 void TouchExplorationController::OnSwipeEvent(ui::GestureEvent* swipe_gesture) { 558 void TouchExplorationController::OnSwipeEvent(ui::GestureEvent* swipe_gesture) {
699 // A swipe gesture contains details for the direction in which the swipe 559 // A swipe gesture contains details for the direction in which the swipe
700 // occurred. 560 // occurred.
701 GestureEventDetails event_details = swipe_gesture->details(); 561 GestureEventDetails event_details = swipe_gesture->details();
702 if (event_details.swipe_left()) { 562 if (event_details.swipe_left()) {
703 DispatchShiftSearchKeyEvent(ui::VKEY_LEFT); 563 DispatchShiftSearchKeyEvent(ui::VKEY_LEFT);
704 return; 564 return;
705 } else if (event_details.swipe_right()) { 565 } else if (event_details.swipe_right()) {
706 DispatchShiftSearchKeyEvent(ui::VKEY_RIGHT); 566 DispatchShiftSearchKeyEvent(ui::VKEY_RIGHT);
707 return; 567 return;
708 } else if (event_details.swipe_up()) { 568 } else if (event_details.swipe_up()) {
709 DispatchShiftSearchKeyEvent(ui::VKEY_UP); 569 DispatchShiftSearchKeyEvent(ui::VKEY_UP);
710 return; 570 return;
711 } else if (event_details.swipe_down()) { 571 } else if (event_details.swipe_down()) {
712 DispatchShiftSearchKeyEvent(ui::VKEY_DOWN); 572 DispatchShiftSearchKeyEvent(ui::VKEY_DOWN);
713 return; 573 return;
714 } 574 }
715 } 575 }
716 576
717 int TouchExplorationController::FindEdgesWithinBounds(gfx::Point point,
718 float bounds) {
719 // Since GetBoundsInScreen is in DIPs but point is not, then point needs to be
720 // converted.
721 root_window_->GetHost()->ConvertPointFromNativeScreen(&point);
722 gfx::Rect window = root_window_->GetBoundsInScreen();
723
724 float left_edge_limit = window.x() + bounds;
725 float right_edge_limit = window.right() - bounds;
726 float top_edge_limit = window.y() + bounds;
727 float bottom_edge_limit = window.bottom() - bounds;
728
729 // Bitwise manipulation in order to determine where on the screen the point
730 // lies. If more than one bit is turned on, then it is a corner where the two
731 // bit/edges intersect. Otherwise, if no bits are turned on, the point must be
732 // in the center of the screen.
733 int result = NO_EDGE;
734 if (point.x() < left_edge_limit)
735 result |= LEFT_EDGE;
736 if (point.x() > right_edge_limit)
737 result |= RIGHT_EDGE;
738 if (point.y() < top_edge_limit)
739 result |= TOP_EDGE;
740 if (point.y() > bottom_edge_limit)
741 result |= BOTTOM_EDGE;
742 return result;
743 }
744
745 void TouchExplorationController::DispatchShiftSearchKeyEvent( 577 void TouchExplorationController::DispatchShiftSearchKeyEvent(
746 const ui::KeyboardCode direction) { 578 const ui::KeyboardCode direction) {
747 // In order to activate the shortcut shift+search+<arrow key> 579 // In order to activate the shortcut shift+search+<arrow key>
748 // three KeyPressed events must be dispatched in succession along 580 // three KeyPressed events must be dispatched in succession along
749 // with three KeyReleased events. 581 // with three KeyReleased events.
750 ui::KeyEvent shift_down = ui::KeyEvent( 582 ui::KeyEvent shift_down = ui::KeyEvent(
751 ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, ui::EF_SHIFT_DOWN, false); 583 ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, ui::EF_SHIFT_DOWN, false);
752 ui::KeyEvent search_down = ui::KeyEvent( 584 ui::KeyEvent search_down = ui::KeyEvent(
753 ui::ET_KEY_PRESSED, kChromeOSSearchKey, ui::EF_SHIFT_DOWN, false); 585 ui::ET_KEY_PRESSED, kChromeOSSearchKey, ui::EF_SHIFT_DOWN, false);
754 ui::KeyEvent direction_down = 586 ui::KeyEvent direction_down =
(...skipping 29 matching lines...) Expand all
784 void TouchExplorationController::EnterTouchToMouseMode() { 616 void TouchExplorationController::EnterTouchToMouseMode() {
785 aura::client::CursorClient* cursor_client = 617 aura::client::CursorClient* cursor_client =
786 aura::client::GetCursorClient(root_window_); 618 aura::client::GetCursorClient(root_window_);
787 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) 619 if (cursor_client && !cursor_client->IsMouseEventsEnabled())
788 cursor_client->EnableMouseEvents(); 620 cursor_client->EnableMouseEvents();
789 if (cursor_client && cursor_client->IsCursorVisible()) 621 if (cursor_client && cursor_client->IsCursorVisible())
790 cursor_client->HideCursor(); 622 cursor_client->HideCursor();
791 } 623 }
792 624
793 void TouchExplorationController::ResetToNoFingersDown() { 625 void TouchExplorationController::ResetToNoFingersDown() {
794 ProcessGestureEvents();
795 if (sound_timer_.IsRunning())
796 sound_timer_.Stop();
797 state_ = NO_FINGERS_DOWN; 626 state_ = NO_FINGERS_DOWN;
798 VLOG_STATE(); 627 VLOG_STATE();
799 if (tap_timer_.IsRunning()) 628 if (tap_timer_.IsRunning())
800 tap_timer_.Stop(); 629 tap_timer_.Stop();
801 } 630 }
802 631
803 void TouchExplorationController::VlogState(const char* function_name) { 632 void TouchExplorationController::VlogState(const char* function_name) {
804 if (!VLOG_on_) 633 if (!VLOG_on_)
805 return; 634 return;
806 if (prev_state_ == state_) 635 if (prev_state_ == state_)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 case GESTURE_IN_PROGRESS: 687 case GESTURE_IN_PROGRESS:
859 return "GESTURE_IN_PROGRESS"; 688 return "GESTURE_IN_PROGRESS";
860 case TOUCH_EXPLORE_SECOND_PRESS: 689 case TOUCH_EXPLORE_SECOND_PRESS:
861 return "TOUCH_EXPLORE_SECOND_PRESS"; 690 return "TOUCH_EXPLORE_SECOND_PRESS";
862 case TWO_TO_ONE_FINGER: 691 case TWO_TO_ONE_FINGER:
863 return "TWO_TO_ONE_FINGER"; 692 return "TWO_TO_ONE_FINGER";
864 case PASSTHROUGH: 693 case PASSTHROUGH:
865 return "PASSTHROUGH"; 694 return "PASSTHROUGH";
866 case WAIT_FOR_RELEASE: 695 case WAIT_FOR_RELEASE:
867 return "WAIT_FOR_RELEASE"; 696 return "WAIT_FOR_RELEASE";
868 case SLIDE_GESTURE:
869 return "SLIDE_GESTURE";
870 } 697 }
871 return "Not a state"; 698 return "Not a state";
872 } 699 }
873 700
874 } // namespace ui 701 } // namespace ui
OLDNEW
« no previous file with comments | « trunk/src/ui/chromeos/touch_exploration_controller.h ('k') | trunk/src/ui/chromeos/touch_exploration_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698