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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "ui/accessibility/ax_enums.h" |
12 #include "ui/chromeos/ui_chromeos_export.h" | 13 #include "ui/chromeos/ui_chromeos_export.h" |
13 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
14 #include "ui/events/event_rewriter.h" | 15 #include "ui/events/event_rewriter.h" |
15 #include "ui/events/gesture_detection/gesture_detector.h" | 16 #include "ui/events/gesture_detection/gesture_detector.h" |
16 #include "ui/events/gestures/gesture_provider_aura.h" | 17 #include "ui/events/gestures/gesture_provider_aura.h" |
17 #include "ui/gfx/geometry/point.h" | 18 #include "ui/gfx/geometry/point.h" |
18 | 19 |
19 namespace aura { | 20 namespace aura { |
20 class Window; | 21 class Window; |
21 } | 22 } |
(...skipping 27 matching lines...) Expand all Loading... |
49 // played. | 50 // played. |
50 virtual void PlayPassthroughEarcon() = 0; | 51 virtual void PlayPassthroughEarcon() = 0; |
51 | 52 |
52 // This function should be called when the exit screen earcon should be | 53 // This function should be called when the exit screen earcon should be |
53 // played. | 54 // played. |
54 virtual void PlayExitScreenEarcon() = 0; | 55 virtual void PlayExitScreenEarcon() = 0; |
55 | 56 |
56 // This function should be called when the enter screen earcon should be | 57 // This function should be called when the enter screen earcon should be |
57 // played. | 58 // played. |
58 virtual void PlayEnterScreenEarcon() = 0; | 59 virtual void PlayEnterScreenEarcon() = 0; |
| 60 |
| 61 // Called when the user performed an accessibility gesture while in touch |
| 62 // accessibility mode, that should be forwarded to ChromeVox. |
| 63 virtual void HandleAccessibilityGesture(ui::AXGesture gesture) = 0; |
59 }; | 64 }; |
60 | 65 |
61 // TouchExplorationController is used in tandem with "Spoken Feedback" to | 66 // TouchExplorationController is used in tandem with "Spoken Feedback" to |
62 // make the touch UI accessible. Gestures performed in the middle of the screen | 67 // make the touch UI accessible. Gestures performed in the middle of the screen |
63 // are mapped to accessibility key shortcuts while gestures performed on the | 68 // are mapped to accessibility key shortcuts while gestures performed on the |
64 // edge of the screen can change settings. | 69 // edge of the screen can change settings. |
65 // | 70 // |
66 // ** Short version ** | 71 // ** Short version ** |
67 // | 72 // |
68 // At a high-level, single-finger events are used for accessibility - | 73 // At a high-level, single-finger events are used for accessibility - |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void OnGestureEvent(ui::GestureConsumer* raw_input_consumer, | 259 void OnGestureEvent(ui::GestureConsumer* raw_input_consumer, |
255 ui::GestureEvent* gesture) override; | 260 ui::GestureEvent* gesture) override; |
256 | 261 |
257 // Process the gesture events that have been created. | 262 // Process the gesture events that have been created. |
258 void ProcessGestureEvents(); | 263 void ProcessGestureEvents(); |
259 | 264 |
260 void OnSwipeEvent(ui::GestureEvent* swipe_gesture); | 265 void OnSwipeEvent(ui::GestureEvent* swipe_gesture); |
261 | 266 |
262 void SideSlideControl(ui::GestureEvent* gesture); | 267 void SideSlideControl(ui::GestureEvent* gesture); |
263 | 268 |
264 // Dispatches the keyboard short cut Shift+Search+<arrow key> | |
265 // outside the event rewritting flow. | |
266 void DispatchShiftSearchKeyEvent(const ui::KeyboardCode third_key); | |
267 | |
268 // Binds DispatchShiftSearchKeyEvent to a specific third key. | |
269 base::Closure BindShiftSearchKeyEvent(const ui::KeyboardCode third_key); | |
270 | |
271 // Dispatches a single key with the given flags. | 269 // Dispatches a single key with the given flags. |
272 void DispatchKeyWithFlags(const ui::KeyboardCode key, int flags); | 270 void DispatchKeyWithFlags(const ui::KeyboardCode key, int flags); |
273 | 271 |
274 // Binds DispatchKeyWithFlags to a specific key and flags. | 272 // Binds DispatchKeyWithFlags to a specific key and flags. |
275 base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags); | 273 base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags); |
276 | 274 |
277 std::unique_ptr<ui::MouseEvent> CreateMouseMoveEvent( | 275 std::unique_ptr<ui::MouseEvent> CreateMouseMoveEvent( |
278 const gfx::PointF& location, | 276 const gfx::PointF& location, |
279 int flags); | 277 int flags); |
280 | 278 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // (e.g. resetting the gesture provider). | 405 // (e.g. resetting the gesture provider). |
408 void SetState(State new_state, const char* function_name); | 406 void SetState(State new_state, const char* function_name); |
409 | 407 |
410 void VlogState(const char* function_name); | 408 void VlogState(const char* function_name); |
411 | 409 |
412 void VlogEvent(const ui::TouchEvent& event, const char* function_name); | 410 void VlogEvent(const ui::TouchEvent& event, const char* function_name); |
413 | 411 |
414 // Gets enum name from integer value. | 412 // Gets enum name from integer value. |
415 const char* EnumStateToString(State state); | 413 const char* EnumStateToString(State state); |
416 | 414 |
417 // Maps each single/multi finger swipe to the function that dispatches | |
418 // the corresponding key events. | |
419 void InitializeSwipeGestureMaps(); | |
420 | |
421 aura::Window* root_window_; | 415 aura::Window* root_window_; |
422 | 416 |
423 // Handles volume control. Not owned. | 417 // Handles volume control. Not owned. |
424 ui::TouchExplorationControllerDelegate* delegate_; | 418 ui::TouchExplorationControllerDelegate* delegate_; |
425 | 419 |
426 // A set of touch ids for fingers currently touching the screen. | 420 // A set of touch ids for fingers currently touching the screen. |
427 std::vector<int> current_touch_ids_; | 421 std::vector<int> current_touch_ids_; |
428 | 422 |
429 // Map of touch ids to their last known location. | 423 // Map of touch ids to their last known location. |
430 std::map<int, gfx::PointF> touch_locations_; | 424 std::map<int, gfx::PointF> touch_locations_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // A copy of the previous event passed. | 468 // A copy of the previous event passed. |
475 std::unique_ptr<ui::TouchEvent> prev_event_; | 469 std::unique_ptr<ui::TouchEvent> prev_event_; |
476 | 470 |
477 // This toggles whether VLOGS are turned on or not. | 471 // This toggles whether VLOGS are turned on or not. |
478 bool VLOG_on_; | 472 bool VLOG_on_; |
479 | 473 |
480 // When touch_exploration_controller gets time relative to real time during | 474 // When touch_exploration_controller gets time relative to real time during |
481 // testing, this clock is set to the simulated clock and used. | 475 // testing, this clock is set to the simulated clock and used. |
482 base::TickClock* tick_clock_; | 476 base::TickClock* tick_clock_; |
483 | 477 |
484 // Maps the number of fingers in a swipe to the resulting functions that | |
485 // dispatch key events. | |
486 std::map<int, base::Closure> left_swipe_gestures_; | |
487 std::map<int, base::Closure> right_swipe_gestures_; | |
488 std::map<int, base::Closure> up_swipe_gestures_; | |
489 std::map<int, base::Closure> down_swipe_gestures_; | |
490 | |
491 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); | 478 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
492 }; | 479 }; |
493 | 480 |
494 } // namespace ui | 481 } // namespace ui |
495 | 482 |
496 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 483 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
OLD | NEW |