| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/renderer_host/input/synthetic_web_input_event_builders
.h" | 5 #include "content/browser/renderer_host/input/synthetic_web_input_event_builders
.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 9 #include "ui/events/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
| 10 | 10 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 touches[index].state = WebTouchPoint::StateMoved; | 161 touches[index].state = WebTouchPoint::StateMoved; |
| 162 type = WebInputEvent::TouchMove; | 162 type = WebInputEvent::TouchMove; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void SyntheticWebTouchEvent::ReleasePoint(int index) { | 165 void SyntheticWebTouchEvent::ReleasePoint(int index) { |
| 166 CHECK(index >= 0 && index < touchesLengthCap); | 166 CHECK(index >= 0 && index < touchesLengthCap); |
| 167 touches[index].state = WebTouchPoint::StateReleased; | 167 touches[index].state = WebTouchPoint::StateReleased; |
| 168 type = WebInputEvent::TouchEnd; | 168 type = WebInputEvent::TouchEnd; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void SyntheticWebTouchEvent::CancelPoint(int index) { |
| 172 CHECK(index >= 0 && index < touchesLengthCap); |
| 173 touches[index].state = WebTouchPoint::StateCancelled; |
| 174 type = WebInputEvent::TouchCancel; |
| 175 } |
| 176 |
| 171 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 177 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
| 172 timeStampSeconds = timestamp.InSecondsF(); | 178 timeStampSeconds = timestamp.InSecondsF(); |
| 173 } | 179 } |
| 174 | 180 |
| 175 SyntheticWebTouchEvent SyntheticWebTouchEventBuilder::Build( | 181 SyntheticWebTouchEvent SyntheticWebTouchEventBuilder::Build( |
| 176 WebInputEvent::Type type) { | 182 WebInputEvent::Type type) { |
| 177 DCHECK(WebInputEvent::isTouchEventType(type)); | 183 DCHECK(WebInputEvent::isTouchEventType(type)); |
| 178 SyntheticWebTouchEvent result; | 184 SyntheticWebTouchEvent result; |
| 179 result.type = type; | 185 result.type = type; |
| 180 return result; | 186 return result; |
| 181 }; | 187 }; |
| 182 | 188 |
| 183 } // namespace content | 189 } // namespace content |
| OLD | NEW |