| 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; |
| 28 class TouchEvent; | 29 class TouchEvent; |
| 29 | 30 |
| 30 // A delegate to handle commands in response to detected accessibility gesture | 31 // A delegate to handle commands in response to detected accessibility gesture |
| 31 // events. | 32 // events. |
| 32 class TouchExplorationControllerDelegate { | 33 class TouchExplorationControllerDelegate { |
| 33 public: | 34 public: |
| 34 virtual ~TouchExplorationControllerDelegate() {} | 35 virtual ~TouchExplorationControllerDelegate() {} |
| 35 | 36 |
| 36 // Takes an int from 0.0 to 100.0 that indicates the percent the volume | 37 // Takes an int from 0.0 to 100.0 that indicates the percent the volume |
| 37 // should be set to. | 38 // should be set to. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // | 174 // |
| 174 // The caller is expected to retain ownership of instances of this class and | 175 // The caller is expected to retain ownership of instances of this class and |
| 175 // destroy them before |root_window| is destroyed. | 176 // destroy them before |root_window| is destroyed. |
| 176 class UI_CHROMEOS_EXPORT TouchExplorationController | 177 class UI_CHROMEOS_EXPORT TouchExplorationController |
| 177 : public ui::EventRewriter, | 178 : public ui::EventRewriter, |
| 178 public ui::GestureProviderAuraClient, | 179 public ui::GestureProviderAuraClient, |
| 179 public ui::GestureConsumer { | 180 public ui::GestureConsumer { |
| 180 public: | 181 public: |
| 181 explicit TouchExplorationController( | 182 explicit TouchExplorationController( |
| 182 aura::Window* root_window, | 183 aura::Window* root_window, |
| 183 ui::TouchExplorationControllerDelegate* delegate); | 184 ui::TouchExplorationControllerDelegate* delegate, |
| 185 TouchAccessibilityEnabler* touch_accessibility_enabler); |
| 184 ~TouchExplorationController() override; | 186 ~TouchExplorationController() override; |
| 185 | 187 |
| 186 // Make synthesized touch events are anchored at this point. This is | 188 // Make synthesized touch events are anchored at this point. This is |
| 187 // called when the object with accessibility focus is updated via something | 189 // called when the object with accessibility focus is updated via something |
| 188 // other than touch exploration. | 190 // other than touch exploration. |
| 189 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); | 191 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); |
| 190 | 192 |
| 191 // Events within the exclude bounds will not be rewritten. | 193 // Events within the exclude bounds will not be rewritten. |
| 192 // |bounds| are in root window coordinates. | 194 // |bounds| are in root window coordinates. |
| 193 void SetExcludeBounds(const gfx::Rect& bounds); | 195 void SetExcludeBounds(const gfx::Rect& bounds); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 501 |
| 500 // A copy of the previous event passed. | 502 // A copy of the previous event passed. |
| 501 std::unique_ptr<ui::TouchEvent> prev_event_; | 503 std::unique_ptr<ui::TouchEvent> prev_event_; |
| 502 | 504 |
| 503 // This toggles whether VLOGS are turned on or not. | 505 // This toggles whether VLOGS are turned on or not. |
| 504 bool VLOG_on_; | 506 bool VLOG_on_; |
| 505 | 507 |
| 506 // LocatedEvents within this area should be left alone. | 508 // LocatedEvents within this area should be left alone. |
| 507 gfx::Rect exclude_bounds_; | 509 gfx::Rect exclude_bounds_; |
| 508 | 510 |
| 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 |
| 509 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); | 517 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
| 510 }; | 518 }; |
| 511 | 519 |
| 512 } // namespace ui | 520 } // namespace ui |
| 513 | 521 |
| 514 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 522 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
| OLD | NEW |