| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/host/touch_injector_win.h" | 5 #include "remoting/host/touch_injector_win.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/native_library.h" | 11 #include "base/native_library.h" |
| 10 #include "remoting/proto/event.pb.h" | 12 #include "remoting/proto/event.pb.h" |
| 11 | 13 |
| 12 namespace remoting { | 14 namespace remoting { |
| 13 | 15 |
| 14 using protocol::TouchEvent; | 16 using protocol::TouchEvent; |
| 15 using protocol::TouchEventPoint; | 17 using protocol::TouchEventPoint; |
| 16 | 18 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 CancelTouchPoints(event); | 184 CancelTouchPoints(event); |
| 183 break; | 185 break; |
| 184 default: | 186 default: |
| 185 NOTREACHED(); | 187 NOTREACHED(); |
| 186 return; | 188 return; |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 | 191 |
| 190 void TouchInjectorWin::SetInjectorDelegateForTest( | 192 void TouchInjectorWin::SetInjectorDelegateForTest( |
| 191 scoped_ptr<TouchInjectorWinDelegate> functions) { | 193 scoped_ptr<TouchInjectorWinDelegate> functions) { |
| 192 delegate_ = functions.Pass(); | 194 delegate_ = std::move(functions); |
| 193 } | 195 } |
| 194 | 196 |
| 195 void TouchInjectorWin::AddNewTouchPoints(const TouchEvent& event) { | 197 void TouchInjectorWin::AddNewTouchPoints(const TouchEvent& event) { |
| 196 DCHECK_EQ(event.event_type(), TouchEvent::TOUCH_POINT_START); | 198 DCHECK_EQ(event.event_type(), TouchEvent::TOUCH_POINT_START); |
| 197 | 199 |
| 198 std::vector<POINTER_TOUCH_INFO> touches; | 200 std::vector<POINTER_TOUCH_INFO> touches; |
| 199 // Must inject already touching points as move events. | 201 // Must inject already touching points as move events. |
| 200 AppendMapValuesToVector(&touches_in_contact_, &touches); | 202 AppendMapValuesToVector(&touches_in_contact_, &touches); |
| 201 | 203 |
| 202 for (const TouchEventPoint& touch_point : event.touch_points()) { | 204 for (const TouchEventPoint& touch_point : event.touch_points()) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 touches.push_back(pointer_touch_info); | 273 touches.push_back(pointer_touch_info); |
| 272 } | 274 } |
| 273 | 275 |
| 274 AppendMapValuesToVector(&touches_in_contact_, &touches); | 276 AppendMapValuesToVector(&touches_in_contact_, &touches); |
| 275 if (delegate_->InjectTouchInput(touches.size(), touches.data()) == 0) { | 277 if (delegate_->InjectTouchInput(touches.size(), touches.data()) == 0) { |
| 276 PLOG(ERROR) << "Failed to inject a touch cancel event."; | 278 PLOG(ERROR) << "Failed to inject a touch cancel event."; |
| 277 } | 279 } |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace remoting | 282 } // namespace remoting |
| OLD | NEW |