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 #ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 5 #ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
6 #define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 6 #define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
7 | 7 |
8 #include "base/time/tick_clock.h" | 8 #include "base/time/tick_clock.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // | 162 // |
163 // The caller is expected to retain ownership of instances of this class and | 163 // The caller is expected to retain ownership of instances of this class and |
164 // destroy them before |root_window| is destroyed. | 164 // destroy them before |root_window| is destroyed. |
165 class UI_CHROMEOS_EXPORT TouchExplorationController | 165 class UI_CHROMEOS_EXPORT TouchExplorationController |
166 : public ui::EventRewriter, | 166 : public ui::EventRewriter, |
167 public ui::GestureProviderAuraClient { | 167 public ui::GestureProviderAuraClient { |
168 public: | 168 public: |
169 explicit TouchExplorationController( | 169 explicit TouchExplorationController( |
170 aura::Window* root_window, | 170 aura::Window* root_window, |
171 ui::TouchExplorationControllerDelegate* delegate); | 171 ui::TouchExplorationControllerDelegate* delegate); |
172 virtual ~TouchExplorationController(); | 172 ~TouchExplorationController() override; |
173 | 173 |
174 private: | 174 private: |
175 friend class TouchExplorationControllerTestApi; | 175 friend class TouchExplorationControllerTestApi; |
176 | 176 |
177 // Overridden from ui::EventRewriter | 177 // Overridden from ui::EventRewriter |
178 virtual ui::EventRewriteStatus RewriteEvent( | 178 ui::EventRewriteStatus RewriteEvent( |
179 const ui::Event& event, | 179 const ui::Event& event, |
180 scoped_ptr<ui::Event>* rewritten_event) override; | 180 scoped_ptr<ui::Event>* rewritten_event) override; |
181 virtual ui::EventRewriteStatus NextDispatchEvent( | 181 ui::EventRewriteStatus NextDispatchEvent( |
182 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) override; | 182 const ui::Event& last_event, |
| 183 scoped_ptr<ui::Event>* new_event) override; |
183 | 184 |
184 // Event handlers based on the current state - see State, below. | 185 // Event handlers based on the current state - see State, below. |
185 ui::EventRewriteStatus InNoFingersDown( | 186 ui::EventRewriteStatus InNoFingersDown( |
186 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); | 187 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); |
187 ui::EventRewriteStatus InSingleTapPressed( | 188 ui::EventRewriteStatus InSingleTapPressed( |
188 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); | 189 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); |
189 ui::EventRewriteStatus InSingleTapOrTouchExploreReleased( | 190 ui::EventRewriteStatus InSingleTapOrTouchExploreReleased( |
190 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); | 191 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); |
191 ui::EventRewriteStatus InDoubleTapPending( | 192 ui::EventRewriteStatus InDoubleTapPending( |
192 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); | 193 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 229 |
229 // Dispatch a new event outside of the event rewriting flow. | 230 // Dispatch a new event outside of the event rewriting flow. |
230 void DispatchEvent(ui::Event* event); | 231 void DispatchEvent(ui::Event* event); |
231 | 232 |
232 // Overridden from GestureProviderAuraClient. | 233 // Overridden from GestureProviderAuraClient. |
233 // | 234 // |
234 // The gesture provider keeps track of all the touch events after | 235 // The gesture provider keeps track of all the touch events after |
235 // the user moves fast enough to trigger a gesture. After the user | 236 // the user moves fast enough to trigger a gesture. After the user |
236 // completes their gesture, this method will decide what keyboard | 237 // completes their gesture, this method will decide what keyboard |
237 // input their gesture corresponded to. | 238 // input their gesture corresponded to. |
238 virtual void OnGestureEvent(ui::GestureEvent* gesture) override; | 239 void OnGestureEvent(ui::GestureEvent* gesture) override; |
239 | 240 |
240 // Process the gesture events that have been created. | 241 // Process the gesture events that have been created. |
241 void ProcessGestureEvents(); | 242 void ProcessGestureEvents(); |
242 | 243 |
243 void OnSwipeEvent(ui::GestureEvent* swipe_gesture); | 244 void OnSwipeEvent(ui::GestureEvent* swipe_gesture); |
244 | 245 |
245 void SideSlideControl(ui::GestureEvent* gesture); | 246 void SideSlideControl(ui::GestureEvent* gesture); |
246 | 247 |
247 // Dispatches the keyboard short cut Shift+Search+<arrow key> | 248 // Dispatches the keyboard short cut Shift+Search+<arrow key> |
248 // outside the event rewritting flow. | 249 // outside the event rewritting flow. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 std::map<int, base::Closure> right_swipe_gestures_; | 470 std::map<int, base::Closure> right_swipe_gestures_; |
470 std::map<int, base::Closure> up_swipe_gestures_; | 471 std::map<int, base::Closure> up_swipe_gestures_; |
471 std::map<int, base::Closure> down_swipe_gestures_; | 472 std::map<int, base::Closure> down_swipe_gestures_; |
472 | 473 |
473 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); | 474 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
474 }; | 475 }; |
475 | 476 |
476 } // namespace ui | 477 } // namespace ui |
477 | 478 |
478 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 479 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
OLD | NEW |