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" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Make synthesized touch events are anchored at this point. This is | 188 // Make synthesized touch events are anchored at this point. This is |
189 // called when the object with accessibility focus is updated via something | 189 // called when the object with accessibility focus is updated via something |
190 // other than touch exploration. | 190 // other than touch exploration. |
191 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); | 191 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); |
192 | 192 |
193 // Events within the exclude bounds will not be rewritten. | 193 // Events within the exclude bounds will not be rewritten. |
194 // |bounds| are in root window coordinates. | 194 // |bounds| are in root window coordinates. |
195 void SetExcludeBounds(const gfx::Rect& bounds); | 195 void SetExcludeBounds(const gfx::Rect& bounds); |
196 | 196 |
| 197 // For touch explore release state that fall within |bounds|, causes a tap to |
| 198 // be synthesized and dispatched to the anchor point. |
| 199 void SetLiftActivationBounds(const gfx::Rect& bounds); |
| 200 |
197 private: | 201 private: |
198 friend class TouchExplorationControllerTestApi; | 202 friend class TouchExplorationControllerTestApi; |
199 | 203 |
200 // Overridden from ui::EventRewriter | 204 // Overridden from ui::EventRewriter |
201 ui::EventRewriteStatus RewriteEvent( | 205 ui::EventRewriteStatus RewriteEvent( |
202 const ui::Event& event, | 206 const ui::Event& event, |
203 std::unique_ptr<ui::Event>* rewritten_event) override; | 207 std::unique_ptr<ui::Event>* rewritten_event) override; |
204 ui::EventRewriteStatus NextDispatchEvent( | 208 ui::EventRewriteStatus NextDispatchEvent( |
205 const ui::Event& last_event, | 209 const ui::Event& last_event, |
206 std::unique_ptr<ui::Event>* new_event) override; | 210 std::unique_ptr<ui::Event>* new_event) override; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags); | 293 base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags); |
290 | 294 |
291 std::unique_ptr<ui::MouseEvent> CreateMouseMoveEvent( | 295 std::unique_ptr<ui::MouseEvent> CreateMouseMoveEvent( |
292 const gfx::PointF& location, | 296 const gfx::PointF& location, |
293 int flags); | 297 int flags); |
294 | 298 |
295 void EnterTouchToMouseMode(); | 299 void EnterTouchToMouseMode(); |
296 | 300 |
297 void PlaySoundForTimer(); | 301 void PlaySoundForTimer(); |
298 | 302 |
299 void SendSimulatedClick(); | 303 void SendSimulatedClickOrTap(); |
| 304 void SendSimulatedTap(); |
| 305 void MaybeSendSimulatedTapInLiftActivationBounds(const ui::TouchEvent& event); |
300 | 306 |
301 // Some constants used in touch_exploration_controller: | 307 // Some constants used in touch_exploration_controller: |
302 | 308 |
303 // Within this many dips of the screen edge, the release event generated will | 309 // Within this many dips of the screen edge, the release event generated will |
304 // reset the state to NoFingersDown. | 310 // reset the state to NoFingersDown. |
305 const float kLeavingScreenEdge = 6; | 311 const float kLeavingScreenEdge = 6; |
306 | 312 |
307 // Swipe/scroll gestures within these bounds (in DIPs) will change preset | 313 // Swipe/scroll gestures within these bounds (in DIPs) will change preset |
308 // settings. | 314 // settings. |
309 const float kMaxDistanceFromEdge = 75; | 315 const float kMaxDistanceFromEdge = 75; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 513 |
508 // LocatedEvents within this area should be left alone. | 514 // LocatedEvents within this area should be left alone. |
509 gfx::Rect exclude_bounds_; | 515 gfx::Rect exclude_bounds_; |
510 | 516 |
511 // Code that detects a touch-screen gesture to enable or disable | 517 // Code that detects a touch-screen gesture to enable or disable |
512 // accessibility. That handler is always running, whereas this is not, | 518 // accessibility. That handler is always running, whereas this is not, |
513 // but events need to be sent to TouchAccessibilityEnabler before being | 519 // but events need to be sent to TouchAccessibilityEnabler before being |
514 // rewritten when TouchExplorationController is running. | 520 // rewritten when TouchExplorationController is running. |
515 TouchAccessibilityEnabler* touch_accessibility_enabler_; | 521 TouchAccessibilityEnabler* touch_accessibility_enabler_; |
516 | 522 |
| 523 gfx::Rect lift_activation_bounds_; |
| 524 |
517 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); | 525 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); |
518 }; | 526 }; |
519 | 527 |
520 } // namespace ui | 528 } // namespace ui |
521 | 529 |
522 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ | 530 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ |
OLD | NEW |