Chromium Code Reviews| Index: ui/chromeos/touch_exploration_controller.h |
| diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..db797d940aea5891e92a066d8212ca4513dea0e3 |
| --- /dev/null |
| +++ b/ui/chromeos/touch_exploration_controller.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| +#define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| + |
| +#include "base/values.h" |
| +#include "ui/chromeos/ui_chromeos_export.h" |
| +#include "ui/events/event_rewriter.h" |
| +#include "ui/gfx/geometry/point.h" |
| + |
| +namespace aura { |
| +class Window; |
| +} |
| + |
| +namespace ui { |
| + |
| +class Event; |
| + |
| +// TouchExplorationController is used in tandem with "Spoken Feedback" to |
| +// make the touch UI accessible. TouchExplorationController rewrites the |
| +// incoming touch events as follows: |
| +// - When one finger is touching the screen, touch events are converted to mouse |
| +// moves. This is the "Touch Exploration Mode". (The idea is that mouse moves |
| +// will be subsequently used by another component to move focus between UI |
| +// elements, and the elements will be read out to the user.) |
| +// - When more than one finger is touching the screen, touches from the |
| +// first (i.e. "oldest") finger are ignored, and the other touches go through |
| +// as is. |
| +class UI_CHROMEOS_EXPORT TouchExplorationController : |
|
sadrul
2014/04/30 18:51:15
What is the expected ownership of this controller
mfomitchev
2014/04/30 21:33:53
Comment added to clarify.
|
| + public ui::EventRewriter { |
| + public: |
| + explicit TouchExplorationController(aura::Window* root_window); |
| + virtual ~TouchExplorationController(); |
| + |
| + private: |
| + // Overridden from ui::EventRewriter |
|
sadrul
2014/04/30 18:51:15
Overrides usually come at the end of the non-overr
mfomitchev
2014/04/30 21:33:53
Done.
|
| + virtual ui::EventRewriteStatus RewriteEvent( |
| + const ui::Event& event, scoped_ptr<ui::Event>* rewritten_event) OVERRIDE; |
| + virtual ui::EventRewriteStatus NextDispatchEvent( |
| + const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) OVERRIDE; |
| + |
| + ui::Event* CreateMouseMoveEvent(gfx::Point location, int flags); |
|
sadrul
2014/04/30 18:51:15
const &Point(F)
This require the owner to take ow
mfomitchev
2014/04/30 21:33:53
Done.
|
| + |
| + void EnterTouchToMouseMode(); |
| + |
| + // A set of touch ids for fingers currently touching the screen. |
| + std::vector<int> touch_ids_; |
| + |
| + // Map of touch ids to their last known location. |
| + std::map<int, gfx::Point> touch_locations_; |
|
sadrul
2014/04/30 18:51:15
Can you use PointF here?
mfomitchev
2014/04/30 21:33:53
Done.
|
| + |
| + // Initialized from RewriteEvent() and dispatched in NextDispatchEvent(). |
| + scoped_ptr<ui::Event> next_dispatch_event_; |
| + |
| + aura::Window* root_window_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |