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

Unified Diff: ui/chromeos/touch_exploration_controller.h

Issue 240333007: wip: Second crack at implementing the touch exploration mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a flag to disable the touch exploration mode. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/chromeos/DEPS ('k') | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 :
+ public ui::EventRewriter {
+ public:
+ explicit TouchExplorationController(aura::Window* root_window);
+ virtual ~TouchExplorationController();
+
+ private:
+ // Overridden from ui::EventRewriter
+ 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);
+
+ 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_;
+
+ // 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_
« no previous file with comments | « ui/chromeos/DEPS ('k') | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698