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 "ppapi/proxy/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/pp_time.h" | 8 #include "ppapi/c/pp_time.h" |
9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 PP_Var message) { | 406 PP_Var message) { |
407 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 407 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
408 API_ID_PPB_INSTANCE, | 408 API_ID_PPB_INSTANCE, |
409 instance, SerializedVarSendInput(dispatcher(), message))); | 409 instance, SerializedVarSendInput(dispatcher(), message))); |
410 } | 410 } |
411 | 411 |
412 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, | 412 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, |
413 PP_MouseCursor_Type type, | 413 PP_MouseCursor_Type type, |
414 PP_Resource image, | 414 PP_Resource image, |
415 const PP_Point* hot_spot) { | 415 const PP_Point* hot_spot) { |
| 416 #if !defined(OS_NACL) |
416 // Some of these parameters are important for security. This check is in the | 417 // Some of these parameters are important for security. This check is in the |
417 // plugin process just for the convenience of the caller (since we don't | 418 // plugin process just for the convenience of the caller (since we don't |
418 // bother returning errors from the other process with a sync message). The | 419 // bother returning errors from the other process with a sync message). The |
419 // parameters will be validated again in the renderer. | 420 // parameters will be validated again in the renderer. |
420 if (!ValidateSetCursorParams(type, image, hot_spot)) | 421 if (!ValidateSetCursorParams(type, image, hot_spot)) |
421 return PP_FALSE; | 422 return PP_FALSE; |
422 | 423 |
423 HostResource image_host_resource; | 424 HostResource image_host_resource; |
424 if (image) { | 425 if (image) { |
425 Resource* cursor_image = | 426 Resource* cursor_image = |
426 PpapiGlobals::Get()->GetResourceTracker()->GetResource(image); | 427 PpapiGlobals::Get()->GetResourceTracker()->GetResource(image); |
427 if (!cursor_image || cursor_image->pp_instance() != instance) | 428 if (!cursor_image || cursor_image->pp_instance() != instance) |
428 return PP_FALSE; | 429 return PP_FALSE; |
429 image_host_resource = cursor_image->host_resource(); | 430 image_host_resource = cursor_image->host_resource(); |
430 } | 431 } |
431 | 432 |
432 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetCursor( | 433 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetCursor( |
433 API_ID_PPB_INSTANCE, instance, static_cast<int32_t>(type), | 434 API_ID_PPB_INSTANCE, instance, static_cast<int32_t>(type), |
434 image_host_resource, hot_spot ? *hot_spot : PP_MakePoint(0, 0))); | 435 image_host_resource, hot_spot ? *hot_spot : PP_MakePoint(0, 0))); |
435 return PP_TRUE; | 436 return PP_TRUE; |
| 437 #else // defined(OS_NACL) |
| 438 return PP_FALSE; |
| 439 #endif |
436 } | 440 } |
437 | 441 |
438 int32_t PPB_Instance_Proxy::LockMouse(PP_Instance instance, | 442 int32_t PPB_Instance_Proxy::LockMouse(PP_Instance instance, |
439 PP_CompletionCallback callback) { | 443 PP_CompletionCallback callback) { |
440 if (!callback.func) | 444 if (!callback.func) |
441 return PP_ERROR_BADARGUMENT; | 445 return PP_ERROR_BADARGUMENT; |
442 | 446 |
443 // Save the mouse callback on the instance data. | 447 // Save the mouse callback on the instance data. |
444 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 448 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
445 GetInstanceData(instance); | 449 GetInstanceData(instance); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 703 } |
700 | 704 |
701 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 705 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
702 PP_Instance instance) { | 706 PP_Instance instance) { |
703 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 707 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
704 API_ID_PPB_INSTANCE, instance, result)); | 708 API_ID_PPB_INSTANCE, instance, result)); |
705 } | 709 } |
706 | 710 |
707 } // namespace proxy | 711 } // namespace proxy |
708 } // namespace ppapi | 712 } // namespace ppapi |
OLD | NEW |