OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| 6 #define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| 7 |
| 8 #include "base/values.h" |
| 9 #include "ui/chromeos/ui_chromeos_export.h" |
| 10 #include "ui/events/event_rewriter.h" |
| 11 #include "ui/gfx/geometry/point.h" |
| 12 |
| 13 namespace aura { |
| 14 class Window; |
| 15 } |
| 16 |
| 17 namespace ui { |
| 18 |
| 19 class Event; |
| 20 |
| 21 // TouchExplorationController is used in tandem with "Spoken Feedback" to |
| 22 // make the touch UI accessible. TouchExplorationController rewrites the |
| 23 // incoming touch events as follows: |
| 24 // - When one finger is touching the screen, touch events are converted to mouse |
| 25 // moves. This is the "Touch Exploration Mode". (The idea is that mouse moves |
| 26 // will be subsequently used by another component to move focus between UI |
| 27 // elements, and the elements will be read out to the user.) |
| 28 // - When more than one finger is touching the screen, touches from the |
| 29 // first (i.e. "oldest") finger are ignored, and the other touches go through |
| 30 // as is. |
| 31 class UI_CHROMEOS_EXPORT TouchExplorationController : |
| 32 public ui::EventRewriter { |
| 33 public: |
| 34 explicit TouchExplorationController(aura::Window* root_window); |
| 35 virtual ~TouchExplorationController(); |
| 36 |
| 37 private: |
| 38 // Overridden from ui::EventRewriter |
| 39 virtual ui::EventRewriteStatus RewriteEvent( |
| 40 const ui::Event& event, scoped_ptr<ui::Event>* rewritten_event) OVERRIDE; |
| 41 virtual ui::EventRewriteStatus NextDispatchEvent( |
| 42 const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) OVERRIDE; |
| 43 |
| 44 ui::Event* CreateMouseMoveEvent(gfx::Point location, int flags); |
| 45 |
| 46 void EnterTouchToMouseMode(); |
| 47 |
| 48 // A set of touch ids for fingers currently touching the screen. |
| 49 std::vector<int> touch_ids_; |
| 50 |
| 51 // Map of touch ids to their last known location. |
| 52 std::map<int, gfx::Point> touch_locations_; |
| 53 |
| 54 // Initialized from RewriteEvent() and dispatched in NextDispatchEvent(). |
| 55 scoped_ptr<ui::Event> next_dispatch_event_; |
| 56 |
| 57 aura::Window* root_window_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
| 60 }; |
| 61 |
| 62 } // namespace ui |
| 63 |
| 64 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
OLD | NEW |