| 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/common/input/synthetic_web_input_event_builders.h" | 5 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
| 9 #include "ui/events/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 float velocity_x, | 140 float velocity_x, |
| 141 float velocity_y, | 141 float velocity_y, |
| 142 WebGestureEvent::SourceDevice source_device) { | 142 WebGestureEvent::SourceDevice source_device) { |
| 143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, | 143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, |
| 144 source_device); | 144 source_device); |
| 145 result.data.flingStart.velocityX = velocity_x; | 145 result.data.flingStart.velocityX = velocity_x; |
| 146 result.data.flingStart.velocityY = velocity_y; | 146 result.data.flingStart.velocityY = velocity_y; |
| 147 return result; | 147 return result; |
| 148 } | 148 } |
| 149 | 149 |
| 150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {} | 150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { |
| 151 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); |
| 152 } |
| 151 | 153 |
| 152 void SyntheticWebTouchEvent::ResetPoints() { | 154 void SyntheticWebTouchEvent::ResetPoints() { |
| 153 int point = 0; | 155 int point = 0; |
| 154 for (unsigned int i = 0; i < touchesLength; ++i) { | 156 for (unsigned int i = 0; i < touchesLength; ++i) { |
| 155 if (touches[i].state == WebTouchPoint::StateReleased) | 157 if (touches[i].state == WebTouchPoint::StateReleased) |
| 156 continue; | 158 continue; |
| 157 | 159 |
| 158 touches[point] = touches[i]; | 160 touches[point] = touches[i]; |
| 159 touches[point].state = WebTouchPoint::StateStationary; | 161 touches[point].state = WebTouchPoint::StateStationary; |
| 160 ++point; | 162 ++point; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 touches[index].state = WebTouchPoint::StateCancelled; | 202 touches[index].state = WebTouchPoint::StateCancelled; |
| 201 WebTouchEventTraits::ResetType( | 203 WebTouchEventTraits::ResetType( |
| 202 WebInputEvent::TouchCancel, timeStampSeconds, this); | 204 WebInputEvent::TouchCancel, timeStampSeconds, this); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 207 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
| 206 timeStampSeconds = timestamp.InSecondsF(); | 208 timeStampSeconds = timestamp.InSecondsF(); |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace content | 211 } // namespace content |
| OLD | NEW |