| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { | 158 LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { |
| 159 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 159 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 160 | 160 |
| 161 // Get the size of the input record. | 161 // Get the size of the input record. |
| 162 UINT size = 0; | 162 UINT size = 0; |
| 163 UINT result = GetRawInputData(input_handle, | 163 UINT result = GetRawInputData(input_handle, |
| 164 RID_INPUT, | 164 RID_INPUT, |
| 165 nullptr, | 165 nullptr, |
| 166 &size, | 166 &size, |
| 167 sizeof(RAWINPUTHEADER)); | 167 sizeof(RAWINPUTHEADER)); |
| 168 if (result == -1) { | 168 if (result == static_cast<UINT>(-1)) { |
| 169 PLOG(ERROR) << "GetRawInputData() failed"; | 169 PLOG(ERROR) << "GetRawInputData() failed"; |
| 170 return 0; | 170 return 0; |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Retrieve the input record itself. | 173 // Retrieve the input record itself. |
| 174 scoped_ptr<uint8[]> buffer(new uint8[size]); | 174 scoped_ptr<uint8[]> buffer(new uint8[size]); |
| 175 RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get()); | 175 RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get()); |
| 176 result = GetRawInputData(input_handle, | 176 result = GetRawInputData(input_handle, |
| 177 RID_INPUT, | 177 RID_INPUT, |
| 178 buffer.get(), | 178 buffer.get(), |
| 179 &size, | 179 &size, |
| 180 sizeof(RAWINPUTHEADER)); | 180 sizeof(RAWINPUTHEADER)); |
| 181 if (result == -1) { | 181 if (result == static_cast<UINT>(-1)) { |
| 182 PLOG(ERROR) << "GetRawInputData() failed"; | 182 PLOG(ERROR) << "GetRawInputData() failed"; |
| 183 return 0; | 183 return 0; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Notify the observer about mouse events generated locally. Remote (injected) | 186 // Notify the observer about mouse events generated locally. Remote (injected) |
| 187 // mouse events do not specify a device handle (based on observed behavior). | 187 // mouse events do not specify a device handle (based on observed behavior). |
| 188 if (input->header.dwType == RIM_TYPEMOUSE && | 188 if (input->header.dwType == RIM_TYPEMOUSE && |
| 189 input->header.hDevice != nullptr) { | 189 input->header.hDevice != nullptr) { |
| 190 POINT position; | 190 POINT position; |
| 191 if (!GetCursorPos(&position)) { | 191 if (!GetCursorPos(&position)) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( | 235 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( |
| 236 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 236 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 237 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 237 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 238 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 238 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 239 base::WeakPtr<ClientSessionControl> client_session_control) { | 239 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 240 return make_scoped_ptr(new LocalInputMonitorWin( | 240 return make_scoped_ptr(new LocalInputMonitorWin( |
| 241 caller_task_runner, ui_task_runner, client_session_control)); | 241 caller_task_runner, ui_task_runner, client_session_control)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace remoting | 244 } // namespace remoting |
| OLD | NEW |