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/client/plugin/pepper_input_handler.h" | 5 #include "remoting/client/plugin/pepper_input_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/cpp/image_data.h" | 8 #include "ppapi/cpp/image_data.h" |
9 #include "ppapi/cpp/input_event.h" | 9 #include "ppapi/cpp/input_event.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 void PepperInputHandler::UpdateMouseCursor() { | 274 void PepperInputHandler::UpdateMouseCursor() { |
275 DCHECK(mouse_lock_state_ == MouseLockDisallowed || | 275 DCHECK(mouse_lock_state_ == MouseLockDisallowed || |
276 mouse_lock_state_ == MouseLockOff); | 276 mouse_lock_state_ == MouseLockOff); |
277 | 277 |
278 if (cursor_image_) { | 278 if (cursor_image_) { |
279 pp::MouseCursor::SetCursor(instance_, PP_MOUSECURSOR_TYPE_CUSTOM, | 279 pp::MouseCursor::SetCursor(instance_, PP_MOUSECURSOR_TYPE_CUSTOM, |
280 *cursor_image_, | 280 *cursor_image_, |
281 cursor_hotspot_); | 281 cursor_hotspot_); |
282 } else { | 282 } else { |
283 // If there is no cursor shape stored, either because the host never | 283 pp::MouseCursor::SetCursor(instance_, PP_MOUSECURSOR_TYPE_NONE); |
284 // supplied one, or we were previously in mouse-lock mode, then use | |
285 // a standard arrow pointer. | |
286 pp::MouseCursor::SetCursor(instance_, PP_MOUSECURSOR_TYPE_POINTER); | |
287 } | 284 } |
288 } | 285 } |
289 | 286 |
290 void PepperInputHandler::OnMouseLocked(int error) { | 287 void PepperInputHandler::OnMouseLocked(int error) { |
291 DCHECK(mouse_lock_state_ == MouseLockRequestPending || | 288 DCHECK(mouse_lock_state_ == MouseLockRequestPending || |
292 mouse_lock_state_ == MouseLockCancelling); | 289 mouse_lock_state_ == MouseLockCancelling); |
293 | 290 |
294 bool should_cancel = (mouse_lock_state_ == MouseLockCancelling); | 291 bool should_cancel = (mouse_lock_state_ == MouseLockCancelling); |
295 | 292 |
296 // See if the operation succeeded. | 293 // See if the operation succeeded. |
297 if (error == PP_OK) { | 294 if (error == PP_OK) { |
298 mouse_lock_state_ = MouseLockOn; | 295 mouse_lock_state_ = MouseLockOn; |
299 } else { | 296 } else { |
300 mouse_lock_state_ = MouseLockOff; | 297 mouse_lock_state_ = MouseLockOff; |
301 UpdateMouseCursor(); | 298 UpdateMouseCursor(); |
302 } | 299 } |
303 | 300 |
304 // Cancel as needed. | 301 // Cancel as needed. |
305 if (should_cancel) | 302 if (should_cancel) |
306 CancelMouseLock(); | 303 CancelMouseLock(); |
307 } | 304 } |
308 | 305 |
309 } // namespace remoting | 306 } // namespace remoting |
OLD | NEW |