| 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/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "ui/accessibility/ax_enums.h" | 11 #include "ui/accessibility/ax_enums.h" |
| 12 #include "ui/chromeos/ui_chromeos_export.h" | 12 #include "ui/chromeos/ui_chromeos_export.h" |
| 13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 14 #include "ui/events/event_rewriter.h" | 14 #include "ui/events/event_rewriter.h" |
| 15 #include "ui/events/gesture_detection/gesture_detector.h" | 15 #include "ui/events/gesture_detection/gesture_detector.h" |
| 16 #include "ui/events/gestures/gesture_provider_aura.h" | 16 #include "ui/events/gestures/gesture_provider_aura.h" |
| 17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
| 18 | 18 |
| 19 namespace aura { | 19 namespace aura { |
| 20 class Window; | 20 class Window; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 | 24 |
| 25 class Event; | 25 class Event; |
| 26 class GestureEvent; | 26 class GestureEvent; |
| 27 class GestureProviderAura; | 27 class GestureProviderAura; |
| 28 class TouchAccessibilityEnabler; | |
| 29 class TouchEvent; | 28 class TouchEvent; |
| 30 | 29 |
| 31 // A delegate to handle commands in response to detected accessibility gesture | 30 // A delegate to handle commands in response to detected accessibility gesture |
| 32 // events. | 31 // events. |
| 33 class TouchExplorationControllerDelegate { | 32 class TouchExplorationControllerDelegate { |
| 34 public: | 33 public: |
| 35 virtual ~TouchExplorationControllerDelegate() {} | 34 virtual ~TouchExplorationControllerDelegate() {} |
| 36 | 35 |
| 37 // Takes an int from 0.0 to 100.0 that indicates the percent the volume | 36 // Takes an int from 0.0 to 100.0 that indicates the percent the volume |
| 38 // should be set to. | 37 // should be set to. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // | 173 // |
| 175 // The caller is expected to retain ownership of instances of this class and | 174 // The caller is expected to retain ownership of instances of this class and |
| 176 // destroy them before |root_window| is destroyed. | 175 // destroy them before |root_window| is destroyed. |
| 177 class UI_CHROMEOS_EXPORT TouchExplorationController | 176 class UI_CHROMEOS_EXPORT TouchExplorationController |
| 178 : public ui::EventRewriter, | 177 : public ui::EventRewriter, |
| 179 public ui::GestureProviderAuraClient, | 178 public ui::GestureProviderAuraClient, |
| 180 public ui::GestureConsumer { | 179 public ui::GestureConsumer { |
| 181 public: | 180 public: |
| 182 explicit TouchExplorationController( | 181 explicit TouchExplorationController( |
| 183 aura::Window* root_window, | 182 aura::Window* root_window, |
| 184 ui::TouchExplorationControllerDelegate* delegate, | 183 ui::TouchExplorationControllerDelegate* delegate); |
| 185 TouchAccessibilityEnabler* touch_accessibility_enabler); | |
| 186 ~TouchExplorationController() override; | 184 ~TouchExplorationController() override; |
| 187 | 185 |
| 188 // Make synthesized touch events are anchored at this point. This is | 186 // Make synthesized touch events are anchored at this point. This is |
| 189 // called when the object with accessibility focus is updated via something | 187 // called when the object with accessibility focus is updated via something |
| 190 // other than touch exploration. | 188 // other than touch exploration. |
| 191 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); | 189 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); |
| 192 | 190 |
| 193 // Events within the exclude bounds will not be rewritten. | 191 // Events within the exclude bounds will not be rewritten. |
| 194 // |bounds| are in root window coordinates. | 192 // |bounds| are in root window coordinates. |
| 195 void SetExcludeBounds(const gfx::Rect& bounds); | 193 void SetExcludeBounds(const gfx::Rect& bounds); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 499 |
| 502 // A copy of the previous event passed. | 500 // A copy of the previous event passed. |
| 503 std::unique_ptr<ui::TouchEvent> prev_event_; | 501 std::unique_ptr<ui::TouchEvent> prev_event_; |
| 504 | 502 |
| 505 // This toggles whether VLOGS are turned on or not. | 503 // This toggles whether VLOGS are turned on or not. |
| 506 bool VLOG_on_; | 504 bool VLOG_on_; |
| 507 | 505 |
| 508 // LocatedEvents within this area should be left alone. | 506 // LocatedEvents within this area should be left alone. |
| 509 gfx::Rect exclude_bounds_; | 507 gfx::Rect exclude_bounds_; |
| 510 | 508 |
| 511 // Code that detects a touch-screen gesture to enable or disable | |
| 512 // accessibility. That handler is always running, whereas this is not, | |
| 513 // but events need to be sent to TouchAccessibilityEnabler before being | |
| 514 // rewritten when TouchExplorationController is running. | |
| 515 TouchAccessibilityEnabler* touch_accessibility_enabler_; | |
| 516 | |
| 517 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); | 509 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
| 518 }; | 510 }; |
| 519 | 511 |
| 520 } // namespace ui | 512 } // namespace ui |
| 521 | 513 |
| 522 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 514 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| OLD | NEW |