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

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

Issue 2628393003: Remove ScopedVector from ui/events/. (Closed)
Patch Set: chromeos2 Created 3 years, 11 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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 839
840 // This is an override for a function that is only called for timer-based events 840 // This is an override for a function that is only called for timer-based events
841 // like long press. Events that are created synchronously as a result of 841 // like long press. Events that are created synchronously as a result of
842 // certain touch events are added to the vector accessible via 842 // certain touch events are added to the vector accessible via
843 // GetAndResetPendingGestures(). We only care about swipes (which are created 843 // GetAndResetPendingGestures(). We only care about swipes (which are created
844 // synchronously), so we ignore this callback. 844 // synchronously), so we ignore this callback.
845 void TouchExplorationController::OnGestureEvent(ui::GestureConsumer* consumer, 845 void TouchExplorationController::OnGestureEvent(ui::GestureConsumer* consumer,
846 ui::GestureEvent* gesture) {} 846 ui::GestureEvent* gesture) {}
847 847
848 void TouchExplorationController::ProcessGestureEvents() { 848 void TouchExplorationController::ProcessGestureEvents() {
849 std::unique_ptr<ScopedVector<ui::GestureEvent>> gestures( 849 std::vector<std::unique_ptr<GestureEvent>> gestures =
850 gesture_provider_->GetAndResetPendingGestures()); 850 gesture_provider_->GetAndResetPendingGestures();
851 if (gestures) { 851 for (const auto& gesture : gestures) {
852 for (ScopedVector<GestureEvent>::iterator i = gestures->begin(); 852 if (gesture->type() == ui::ET_GESTURE_SWIPE &&
853 i != gestures->end(); 853 state_ == GESTURE_IN_PROGRESS) {
854 ++i) { 854 OnSwipeEvent(gesture.get());
855 if ((*i)->type() == ui::ET_GESTURE_SWIPE && 855 // The tap timer to leave gesture state is ended, and we now wait for
856 state_ == GESTURE_IN_PROGRESS) { 856 // all fingers to be released.
857 OnSwipeEvent(*i); 857 tap_timer_.Stop();
858 // The tap timer to leave gesture state is ended, and we now wait for 858 SET_STATE(WAIT_FOR_NO_FINGERS);
859 // all fingers to be released. 859 return;
860 tap_timer_.Stop(); 860 }
861 SET_STATE(WAIT_FOR_NO_FINGERS); 861 if (state_ == SLIDE_GESTURE && gesture->IsScrollGestureEvent()) {
862 return; 862 SideSlideControl(gesture.get());
863 }
864 if (state_ == SLIDE_GESTURE && (*i)->IsScrollGestureEvent()) {
865 SideSlideControl(*i);
866 }
867 } 863 }
868 } 864 }
869 } 865 }
870 866
871 void TouchExplorationController::SideSlideControl(ui::GestureEvent* gesture) { 867 void TouchExplorationController::SideSlideControl(ui::GestureEvent* gesture) {
872 ui::EventType type = gesture->type(); 868 ui::EventType type = gesture->type();
873 869
874 if (type == ET_GESTURE_SCROLL_BEGIN) { 870 if (type == ET_GESTURE_SCROLL_BEGIN) {
875 delegate_->PlayVolumeAdjustEarcon(); 871 delegate_->PlayVolumeAdjustEarcon();
876 } 872 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 return "TWO_FINGER_TAP"; 1186 return "TWO_FINGER_TAP";
1191 } 1187 }
1192 return "Not a state"; 1188 return "Not a state";
1193 } 1189 }
1194 1190
1195 float TouchExplorationController::GetSplitTapTouchSlop() { 1191 float TouchExplorationController::GetSplitTapTouchSlop() {
1196 return gesture_detector_config_.touch_slop * 3; 1192 return gesture_detector_config_.touch_slop * 3;
1197 } 1193 }
1198 1194
1199 } // namespace ui 1195 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698