OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "ui/chromeos/touch_accessibility_enabler.h" | 5 #include "ui/chromeos/touch_accessibility_enabler.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Skip events rewritten by TouchExplorationController, it will hand | 53 // Skip events rewritten by TouchExplorationController, it will hand |
54 // us the unrewritten events directly. | 54 // us the unrewritten events directly. |
55 if (!(event->flags() & ui::EF_TOUCH_ACCESSIBILITY)) | 55 if (!(event->flags() & ui::EF_TOUCH_ACCESSIBILITY)) |
56 HandleTouchEvent(*event); | 56 HandleTouchEvent(*event); |
57 } | 57 } |
58 | 58 |
59 void TouchAccessibilityEnabler::HandleTouchEvent(const ui::TouchEvent& event) { | 59 void TouchAccessibilityEnabler::HandleTouchEvent(const ui::TouchEvent& event) { |
60 DCHECK(!(event.flags() & ui::EF_TOUCH_ACCESSIBILITY)); | 60 DCHECK(!(event.flags() & ui::EF_TOUCH_ACCESSIBILITY)); |
61 const ui::EventType type = event.type(); | 61 const ui::EventType type = event.type(); |
62 const gfx::PointF& location = event.location_f(); | 62 const gfx::PointF& location = event.location_f(); |
63 const int touch_id = event.touch_id(); | 63 const int touch_id = event.pointer_details().id; |
64 | 64 |
65 if (type == ui::ET_TOUCH_PRESSED) { | 65 if (type == ui::ET_TOUCH_PRESSED) { |
66 touch_locations_.insert(std::pair<int, gfx::PointF>(touch_id, location)); | 66 touch_locations_.insert(std::pair<int, gfx::PointF>(touch_id, location)); |
67 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 67 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
68 auto iter = touch_locations_.find(touch_id); | 68 auto iter = touch_locations_.find(touch_id); |
69 | 69 |
70 // Can happen if this object is constructed while fingers were down. | 70 // Can happen if this object is constructed while fingers were down. |
71 if (iter == touch_locations_.end()) | 71 if (iter == touch_locations_.end()) |
72 return; | 72 return; |
73 | 73 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 tick_count < kTimerTicksToToggleSpokenFeedback) { | 149 tick_count < kTimerTicksToToggleSpokenFeedback) { |
150 delegate_->PlaySpokenFeedbackToggleCountdown(tick_count); | 150 delegate_->PlaySpokenFeedbackToggleCountdown(tick_count); |
151 } | 151 } |
152 if (tick_count == kTimerTicksToToggleSpokenFeedback) { | 152 if (tick_count == kTimerTicksToToggleSpokenFeedback) { |
153 delegate_->ToggleSpokenFeedback(); | 153 delegate_->ToggleSpokenFeedback(); |
154 state_ = WAIT_FOR_NO_FINGERS; | 154 state_ = WAIT_FOR_NO_FINGERS; |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 } // namespace ui | 158 } // namespace ui |
OLD | NEW |