diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-08 20:28:43 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-08 20:28:43 +0000 |
commit | 33ec505631bcc1cc6709248b97b468fbdf3d5f0a (patch) | |
tree | 4963e5e21af0f8173c5b6353c34209993b5da852 /ppapi/native_client | |
parent | 41c3696d8ebb37c0b2e0afd0361f0b40bc369483 (diff) | |
download | chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.zip chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.tar.gz chromium_src-33ec505631bcc1cc6709248b97b468fbdf3d5f0a.tar.bz2 |
Add new MouseCursor interface for setting the mouse cursor.
Remove most of the old cursor control interface. This keeps backwards compat for CursorControl.SetCursor (which just redirects to the new function) to kepe existing users running. None of the other functions on cursor control were implemented, so I removed all the proxying and stuff for them.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9814015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
24 files changed, 254 insertions, 593 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc index e5c0d91..35a6e8f 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc @@ -347,13 +347,6 @@ const PPB_WheelInputEvent* PPBWheelInputEventInterface() { } // Dev interfaces. -const PPB_CursorControl_Dev* PPBCursorControlInterface() { - static const PPB_CursorControl_Dev* ppb = - static_cast<const PPB_CursorControl_Dev*>( - GetBrowserInterfaceSafe(PPB_CURSOR_CONTROL_DEV_INTERFACE)); - return ppb; -} - const PPB_FileIO* PPBFileIOInterface() { static const PPB_FileIO* ppb = static_cast<const PPB_FileIO*>( @@ -403,6 +396,13 @@ const PPB_Gamepad* PPBGamepadInterface() { return ppb; } +const PPB_MouseCursor_1_0* PPBMouseCursorInterface() { + static const PPB_MouseCursor_1_0* ppb = + static_cast<const PPB_MouseCursor_1_0*>( + GetBrowserInterfaceSafe(PPB_MOUSECURSOR_INTERFACE_1_0)); + return ppb; +} + const PPB_MouseLock* PPBMouseLockInterface() { static const PPB_MouseLock* ppb = static_cast<const PPB_MouseLock*>( GetBrowserInterfaceSafe(PPB_MOUSELOCK_INTERFACE)); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h index 62ebd9b..d8f37a9 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h @@ -5,7 +5,6 @@ #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_GLOBALS_H_ #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_GLOBALS_H_ -#include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" @@ -28,6 +27,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" @@ -102,7 +102,7 @@ const void* GetBrowserInterfaceSafe(const char* interface_name); // plugin side of the proxy, so they can be used by the shared proxy code // under both trusted and untrusted compilation. const PPB_Core* PPBCoreInterface(); // shared -const PPB_CursorControl_Dev* PPBCursorControlInterface(); +const PPB_MouseCursor_1_0* PPBMouseCursorInterface(); const PPB_FileIO* PPBFileIOInterface(); const PPB_FileRef* PPBFileRefInterface(); const PPB_FileSystem* PPBFileSystemInterface(); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_cursor_control_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_cursor_control_rpc_server.cc deleted file mode 100644 index b0b3218..0000000 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_cursor_control_rpc_server.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// SRPC-abstraction wrappers around PPB_CursorControl_Dev functions. - -#include "native_client/src/include/nacl_macros.h" -#include "native_client/src/include/nacl_scoped_ptr.h" -#include "native_client/src/include/portability.h" -#include "native_client/src/shared/ppapi_proxy/browser_globals.h" -#include "native_client/src/shared/ppapi_proxy/utility.h" -#include "native_client/src/trusted/desc/nacl_desc_wrapper.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/c/ppb_image_data.h" -#include "srpcgen/ppb_rpc.h" - -using ppapi_proxy::DebugPrintf; -using ppapi_proxy::PPBCursorControlInterface; - -void PpbCursorControlRpcServer::PPB_CursorControl_SetCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t type, - PP_Resource custom_image, - nacl_abi_size_t hot_spot_size, char* hot_spot, - int32_t* success) { - NaClSrpcClosureRunner runner(done); - rpc->result = NACL_SRPC_RESULT_APP_ERROR; - - PP_Point* pp_hot_spot = NULL; - if (hot_spot_size != 0) { - if (hot_spot_size != sizeof(struct PP_Point)) - return; - pp_hot_spot = reinterpret_cast<struct PP_Point*>(hot_spot); - } - PP_Bool pp_success = PPBCursorControlInterface()->SetCursor( - instance, - static_cast<PP_CursorType_Dev>(type), - custom_image, - pp_hot_spot); - *success = PP_ToBool(pp_success); - - DebugPrintf("PPB_CursorControl::SetCursor: success=%"NACL_PRId32"\n", - *success); - rpc->result = NACL_SRPC_RESULT_OK; -} - -void PpbCursorControlRpcServer::PPB_CursorControl_LockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success) { - NaClSrpcClosureRunner runner(done); - rpc->result = NACL_SRPC_RESULT_APP_ERROR; - - PP_Bool pp_success = PPBCursorControlInterface()->LockCursor(instance); - *success = PP_ToBool(pp_success); - - DebugPrintf("PPB_CursorControl::LockCursor: success=%"NACL_PRId32"\n", - *success); - rpc->result = NACL_SRPC_RESULT_OK; -} - -void PpbCursorControlRpcServer::PPB_CursorControl_UnlockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success) { - NaClSrpcClosureRunner runner(done); - rpc->result = NACL_SRPC_RESULT_APP_ERROR; - - PP_Bool pp_success = PPBCursorControlInterface()->UnlockCursor(instance); - *success = PP_ToBool(pp_success); - - DebugPrintf("PPB_CursorControl::UnlockCursor: success=%"NACL_PRId32"\n", - *success); - rpc->result = NACL_SRPC_RESULT_OK; -} - -void PpbCursorControlRpcServer::PPB_CursorControl_HasCursorLock( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success) { - NaClSrpcClosureRunner runner(done); - rpc->result = NACL_SRPC_RESULT_APP_ERROR; - - PP_Bool pp_success = PPBCursorControlInterface()->HasCursorLock(instance); - *success = PP_ToBool(pp_success); - - DebugPrintf("PPB_CursorControl::HasCursorLock: success=%"NACL_PRId32"\n", - *success); - rpc->result = NACL_SRPC_RESULT_OK; -} - -void PpbCursorControlRpcServer::PPB_CursorControl_CanLockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success) { - NaClSrpcClosureRunner runner(done); - rpc->result = NACL_SRPC_RESULT_APP_ERROR; - - PP_Bool pp_success = PPBCursorControlInterface()->CanLockCursor(instance); - *success = PP_ToBool(pp_success); - - DebugPrintf("PPB_CursorControl::CanLockCursor: success=%"NACL_PRId32"\n", - *success); - rpc->result = NACL_SRPC_RESULT_OK; -} diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc new file mode 100644 index 0000000..96c4687 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_cursor_rpc_server.cc @@ -0,0 +1,49 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// SRPC-abstraction wrappers around PPB_MouseCursor functions. + +#include "native_client/src/include/nacl_macros.h" +#include "native_client/src/include/nacl_scoped_ptr.h" +#include "native_client/src/include/portability.h" +#include "native_client/src/shared/ppapi_proxy/browser_globals.h" +#include "native_client/src/shared/ppapi_proxy/utility.h" +#include "native_client/src/trusted/desc/nacl_desc_wrapper.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/ppb_image_data.h" +#include "ppapi/c/ppb_mouse_cursor.h" +#include "srpcgen/ppb_rpc.h" + +using ppapi_proxy::DebugPrintf; +using ppapi_proxy::PPBMouseCursorInterface; + +void PpbMouseCursorRpcServer::PPB_MouseCursor_SetCursor( + NaClSrpcRpc* rpc, + NaClSrpcClosure* done, + PP_Instance instance, + int32_t type, + PP_Resource custom_image, + nacl_abi_size_t hot_spot_size, char* hot_spot, + int32_t* success) { + NaClSrpcClosureRunner runner(done); + rpc->result = NACL_SRPC_RESULT_APP_ERROR; + + PP_Point* pp_hot_spot = NULL; + if (hot_spot_size != 0) { + if (hot_spot_size != sizeof(struct PP_Point)) + return; + pp_hot_spot = reinterpret_cast<struct PP_Point*>(hot_spot); + } + PP_Bool pp_success = PPBMouseCursorInterface()->SetCursor( + instance, + static_cast<PP_MouseCursor_Type>(type), + custom_image, + pp_hot_spot); + *success = PP_ToBool(pp_success); + + DebugPrintf("PPB_MouseCursor::SetCursor: success=%"NACL_PRId32"\n", + *success); + rpc->result = NACL_SRPC_RESULT_OK; +} diff --git a/ppapi/native_client/src/shared/ppapi_proxy/build.scons b/ppapi/native_client/src/shared/ppapi_proxy/build.scons index 83b7d2d..9fa7068 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/build.scons +++ b/ppapi/native_client/src/shared/ppapi_proxy/build.scons @@ -39,7 +39,6 @@ env.DualLibrary('ppapi_browser', 'browser_ppb_audio_rpc_server.cc', 'browser_ppb_audio_config_rpc_server.cc', 'browser_ppb_core_rpc_server.cc', - 'browser_ppb_cursor_control_rpc_server.cc', 'browser_ppb_file_io_rpc_server.cc', 'browser_ppb_file_ref_rpc_server.cc', 'browser_ppb_file_system_rpc_server.cc', @@ -54,6 +53,7 @@ env.DualLibrary('ppapi_browser', 'browser_ppb_input_event_rpc_server.cc', 'browser_ppb_instance_rpc_server.cc', 'browser_ppb_messaging_rpc_server.cc', + 'browser_ppb_mouse_cursor_rpc_server.cc', 'browser_ppb_mouse_lock_rpc_server.cc', 'browser_ppb_net_address_private_rpc_server.cc', 'browser_ppb_pdf_rpc_server.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons index 911a00c..0409965 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons +++ b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons @@ -60,7 +60,6 @@ libppruntime = env.NaClSdkLibrary( 'plugin_ppb_audio_config.cc', 'plugin_ppb_buffer.cc', 'plugin_ppb_core.cc', - 'plugin_ppb_cursor_control.cc', 'plugin_ppb_file_io.cc', 'plugin_ppb_file_system.cc', 'plugin_ppb_file_ref.cc', @@ -76,6 +75,7 @@ libppruntime = env.NaClSdkLibrary( 'plugin_ppb_instance.cc', 'plugin_ppb_memory.cc', 'plugin_ppb_messaging.cc', + 'plugin_ppb_mouse_cursor.cc', 'plugin_ppb_mouse_lock.cc', 'plugin_ppb_net_address_private.cc', 'plugin_ppb_pdf.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc index 2f2a9b1..e2dbe9a 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc @@ -11,7 +11,6 @@ #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" -#include "native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h" @@ -27,6 +26,7 @@ #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h" +#include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h" #include "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" @@ -63,7 +63,7 @@ InterfaceMapElement interface_map[] = { { PPB_AUDIO_CONFIG_INTERFACE_1_0, PluginAudioConfig::GetInterface1_0(), true }, { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true }, - { PPB_CURSOR_CONTROL_DEV_INTERFACE, PluginCursorControl::GetInterface(), + { PPB_MOUSECURSOR_INTERFACE_1_0, PluginMouseCursor::GetInterface(), true }, { PPB_FILEIO_INTERFACE, PluginFileIO::GetInterface(), true }, { PPB_FILEREF_INTERFACE, PluginFileRef::GetInterface(), true }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc deleted file mode 100644 index a36c992..0000000 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h" - -#include "native_client/src/include/portability.h" -#include "native_client/src/shared/ppapi_proxy/plugin_callback.h" -#include "native_client/src/shared/ppapi_proxy/plugin_globals.h" -#include "native_client/src/shared/ppapi_proxy/utility.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_errors.h" -#include "srpcgen/ppb_rpc.h" - -namespace ppapi_proxy { - -namespace { - -const nacl_abi_size_t kPPPointBytes = - static_cast<nacl_abi_size_t>(sizeof(struct PP_Point)); - -PP_Bool SetCursor(PP_Instance instance, - enum PP_CursorType_Dev type, - PP_Resource custom_image, - const struct PP_Point* hot_spot) { - DebugPrintf("PPB_CursorControl::SetCursor: " - "instance=%"NACL_PRId32"\n", instance); - - int32_t hot_spot_size = (hot_spot != NULL) ? kPPPointBytes : 0; - int32_t success = 0; - NaClSrpcError srpc_result = - PpbCursorControlRpcClient::PPB_CursorControl_SetCursor( - GetMainSrpcChannel(), - instance, - type, - custom_image, - hot_spot_size, - reinterpret_cast<char*>(const_cast<struct PP_Point*>(hot_spot)), - &success); - - DebugPrintf("PPB_CursorControl::SetCursor: %s\n", - NaClSrpcErrorString(srpc_result)); - if (srpc_result == NACL_SRPC_RESULT_OK && success) - return PP_TRUE; - return PP_FALSE; -} - -PP_Bool LockCursor(PP_Instance instance) { - DebugPrintf("PPB_CursorControl::LockCursor: " - "instance=%"NACL_PRId32"\n", instance); - - int32_t success = 0; - NaClSrpcError srpc_result = - PpbCursorControlRpcClient::PPB_CursorControl_LockCursor( - GetMainSrpcChannel(), - instance, - &success); - - DebugPrintf("PPB_CursorControl::LockCursor: %s\n", - NaClSrpcErrorString(srpc_result)); - - if (srpc_result == NACL_SRPC_RESULT_OK && success) - return PP_TRUE; - return PP_FALSE; -} - -PP_Bool UnlockCursor(PP_Instance instance) { - DebugPrintf("PPB_CursorControl::UnlockCursor: " - "instance=%"NACL_PRId32"\n", instance); - - int32_t success = 0; - NaClSrpcError srpc_result = - PpbCursorControlRpcClient::PPB_CursorControl_UnlockCursor( - GetMainSrpcChannel(), - instance, - &success); - - DebugPrintf("PPB_CursorControl::UnlockCursor: %s\n", - NaClSrpcErrorString(srpc_result)); - - if (srpc_result == NACL_SRPC_RESULT_OK && success) - return PP_TRUE; - return PP_FALSE; -} - -PP_Bool HasCursorLock(PP_Instance instance) { - DebugPrintf("PPB_CursorControl::HasCursorLock: " - "instance=%"NACL_PRId32"\n", instance); - - int32_t success = 0; - NaClSrpcError srpc_result = - PpbCursorControlRpcClient::PPB_CursorControl_HasCursorLock( - GetMainSrpcChannel(), - instance, - &success); - - DebugPrintf("PPB_CursorControl::HasCursorLock: %s\n", - NaClSrpcErrorString(srpc_result)); - - if (srpc_result == NACL_SRPC_RESULT_OK && success) - return PP_TRUE; - return PP_FALSE; -} - -PP_Bool CanLockCursor(PP_Instance instance) { - DebugPrintf("PPB_CursorControl::CanLockCursor: " - "instance=%"NACL_PRId32"\n", instance); - - int32_t success = 0; - NaClSrpcError srpc_result = - PpbCursorControlRpcClient::PPB_CursorControl_CanLockCursor( - GetMainSrpcChannel(), - instance, - &success); - - DebugPrintf("PPB_CursorControl::CanLockCursor: %s\n", - NaClSrpcErrorString(srpc_result)); - - if (srpc_result == NACL_SRPC_RESULT_OK && success) - return PP_TRUE; - return PP_FALSE; -} - -} // namespace - -const PPB_CursorControl_Dev* PluginCursorControl::GetInterface() { - static const PPB_CursorControl_Dev cursor_control_interface = { - SetCursor, - LockCursor, - UnlockCursor, - HasCursorLock, - CanLockCursor - }; - return &cursor_control_interface; -} - -} // namespace ppapi_proxy diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h deleted file mode 100644 index a90b26f..0000000 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_CURSOR_CONTROL_H_ -#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_CURSOR_CONTROL_H_ - -#include "native_client/src/include/nacl_macros.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" - -namespace ppapi_proxy { - -// Implements the untrusted side of the PPB_CursorControl_Dev interface. -class PluginCursorControl { - public: - PluginCursorControl(); - static const PPB_CursorControl_Dev* GetInterface(); - - private: - NACL_DISALLOW_COPY_AND_ASSIGN(PluginCursorControl); -}; - -} // namespace ppapi_proxy - -#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_CURSOR_CONTROL_H_ - diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc new file mode 100644 index 0000000..76a2185 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.cc @@ -0,0 +1,58 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h" + +#include "native_client/src/include/portability.h" +#include "native_client/src/shared/ppapi_proxy/plugin_callback.h" +#include "native_client/src/shared/ppapi_proxy/plugin_globals.h" +#include "native_client/src/shared/ppapi_proxy/utility.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_mouse_cursor.h" +#include "srpcgen/ppb_rpc.h" + +namespace ppapi_proxy { + +namespace { + +const nacl_abi_size_t kPPPointBytes = + static_cast<nacl_abi_size_t>(sizeof(struct PP_Point)); + +PP_Bool SetCursor(PP_Instance instance, + enum PP_MouseCursor_Type type, + PP_Resource custom_image, + const struct PP_Point* hot_spot) { + DebugPrintf("PPB_MouseCursor::SetCursor: " + "instance=%"NACL_PRId32"\n", instance); + + int32_t hot_spot_size = (hot_spot != NULL) ? kPPPointBytes : 0; + int32_t success = 0; + NaClSrpcError srpc_result = + PpbMouseCursorRpcClient::PPB_MouseCursor_SetCursor( + GetMainSrpcChannel(), + instance, + type, + custom_image, + hot_spot_size, + reinterpret_cast<char*>(const_cast<struct PP_Point*>(hot_spot)), + &success); + + DebugPrintf("PPB_MouseCursor::SetCursor: %s\n", + NaClSrpcErrorString(srpc_result)); + if (srpc_result == NACL_SRPC_RESULT_OK && success) + return PP_TRUE; + return PP_FALSE; +} + +} // namespace + +const PPB_MouseCursor_1_0* PluginMouseCursor::GetInterface() { + static const PPB_MouseCursor mouse_cursor_interface = { + SetCursor, + }; + return &mouse_cursor_interface; +} + +} // namespace ppapi_proxy diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h new file mode 100644 index 0000000..490a8d4 --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_ +#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_ + +#include "native_client/src/include/nacl_macros.h" +#include "ppapi/c/ppb_mouse_cursor.h" + +namespace ppapi_proxy { + +// Implements the untrusted side of the PPB_MouseCursor interface. +class PluginMouseCursor { + public: + PluginMouseCursor(); + static const PPB_MouseCursor_1_0* GetInterface(); + + private: + NACL_DISALLOW_COPY_AND_ASSIGN(PluginMouseCursor); +}; + +} // namespace ppapi_proxy + +#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_CURSOR_H_ + diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp index 5922275..4918710 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp @@ -34,7 +34,6 @@ 'browser_ppb_audio_config_rpc_server.cc', 'browser_ppb_audio_rpc_server.cc', 'browser_ppb_core_rpc_server.cc', - 'browser_ppb_cursor_control_rpc_server.cc', 'browser_ppb_file_io_rpc_server.cc', 'browser_ppb_file_ref_rpc_server.cc', 'browser_ppb_file_system_rpc_server.cc', @@ -49,6 +48,7 @@ 'browser_ppb_input_event_rpc_server.cc', 'browser_ppb_instance_rpc_server.cc', 'browser_ppb_messaging_rpc_server.cc', + 'browser_ppb_mouse_cursor_rpc_server.cc', 'browser_ppb_mouse_lock_rpc_server.cc', 'browser_ppb_net_address_private_rpc_server.cc', 'browser_ppb_pdf_rpc_server.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp index d2dff3d..5761d0e 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp @@ -57,7 +57,6 @@ 'plugin_ppb_audio_config.cc', 'plugin_ppb_buffer.cc', 'plugin_ppb_core.cc', - 'plugin_ppb_cursor_control.cc', 'plugin_ppb_file_io.cc', 'plugin_ppb_file_system.cc', 'plugin_ppb_file_ref.cc', @@ -73,6 +72,7 @@ 'plugin_ppb_instance.cc', 'plugin_ppb_memory.cc', 'plugin_ppb_messaging.cc', + 'plugin_ppb_mouse_cursor.cc', 'plugin_ppb_mouse_lock.cc', 'plugin_ppb_net_address_private.cc', 'plugin_ppb_pdf.cc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_cursor_control.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_cursor_control.srpc deleted file mode 100644 index 1b1115b..0000000 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_cursor_control.srpc +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2011 The Native Client Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# RPC methods used to implement PPB_CursorControl calls from the plugin. -# See ppapi/c/ppb_cursor_control_dev.h for interface details. - -{ - 'name': 'PpbCursorControlRpc', - 'rpcs': [ - {'name': 'PPB_CursorControl_SetCursor', - 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ['type', 'int32_t'], # PP_CursorType_Dev - ['custom_image', 'PP_Resource'], # PP_Resource - ['hot_spot', 'char[]'], # PP_Point - ], - 'outputs': [['success', 'int32_t'], # PP_Bool - ] - }, - {'name': 'PPB_CursorControl_LockCursor', - 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ], - 'outputs': [['success', 'int32_t'], # PP_Bool - ] - }, - {'name': 'PPB_CursorControl_UnlockCursor', - 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ], - 'outputs': [['success', 'int32_t'], # PP_Bool - ] - }, - {'name': 'PPB_CursorControl_HasCursorLock', - 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ], - 'outputs': [['success', 'int32_t'], # PP_Bool - ] - }, - {'name': 'PPB_CursorControl_CanLockCursor', - 'inputs': [['instance', 'PP_Instance'], # PP_Instance - ], - 'outputs': [['success', 'int32_t'], # PP_Bool - ] - }, - ] -} diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc new file mode 100644 index 0000000..474e68b --- /dev/null +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_cursor.srpc @@ -0,0 +1,20 @@ +# Copyright (c) 2011 The Native Client Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# RPC methods used to implement PPB_MouseCursor calls from the plugin. + +{ + 'name': 'PpbMouseCursorRpc', + 'rpcs': [ + {'name': 'PPB_MouseCursor_SetCursor', + 'inputs': [['instance', 'PP_Instance'], # PP_Instance + ['type', 'int32_t'], # PP_MouseCursor_Type + ['custom_image', 'PP_Resource'], # PP_Resource + ['hot_spot', 'char[]'], # PP_Point + ], + 'outputs': [['success', 'int32_t'], # PP_Bool + ] + }, + ] +} diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc index c869403..5f139eb 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_client.cc @@ -385,97 +385,6 @@ NaClSrpcError PpbCoreRpcClient::PPB_Core_CallOnMainThread( return retval; } -NaClSrpcError PpbCursorControlRpcClient::PPB_CursorControl_SetCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t type, - PP_Resource custom_image, - nacl_abi_size_t hot_spot_bytes, char* hot_spot, - int32_t* success) { - VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), - ("%s: PPAPI calls are not supported off the main thread\n", - __FUNCTION__)); - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPB_CursorControl_SetCursor:iiiC:i", - instance, - type, - custom_image, - hot_spot_bytes, hot_spot, - success - ); - return retval; -} - -NaClSrpcError PpbCursorControlRpcClient::PPB_CursorControl_LockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success) { - VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), - ("%s: PPAPI calls are not supported off the main thread\n", - __FUNCTION__)); - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPB_CursorControl_LockCursor:i:i", - instance, - success - ); - return retval; -} - -NaClSrpcError PpbCursorControlRpcClient::PPB_CursorControl_UnlockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success) { - VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), - ("%s: PPAPI calls are not supported off the main thread\n", - __FUNCTION__)); - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPB_CursorControl_UnlockCursor:i:i", - instance, - success - ); - return retval; -} - -NaClSrpcError PpbCursorControlRpcClient::PPB_CursorControl_HasCursorLock( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success) { - VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), - ("%s: PPAPI calls are not supported off the main thread\n", - __FUNCTION__)); - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPB_CursorControl_HasCursorLock:i:i", - instance, - success - ); - return retval; -} - -NaClSrpcError PpbCursorControlRpcClient::PPB_CursorControl_CanLockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success) { - VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), - ("%s: PPAPI calls are not supported off the main thread\n", - __FUNCTION__)); - NaClSrpcError retval; - retval = NaClSrpcInvokeBySignature( - channel, - "PPB_CursorControl_CanLockCursor:i:i", - instance, - success - ); - return retval; -} - NaClSrpcError PpbFileIORpcClient::PPB_FileIO_Create( NaClSrpcChannel* channel, PP_Instance instance, @@ -2047,6 +1956,29 @@ NaClSrpcError PpbMessagingRpcClient::PPB_Messaging_PostMessage( return retval; } +NaClSrpcError PpbMouseCursorRpcClient::PPB_MouseCursor_SetCursor( + NaClSrpcChannel* channel, + PP_Instance instance, + int32_t type, + PP_Resource custom_image, + nacl_abi_size_t hot_spot_bytes, char* hot_spot, + int32_t* success) { + VCHECK(ppapi_proxy::PPBCoreInterface()->IsMainThread(), + ("%s: PPAPI calls are not supported off the main thread\n", + __FUNCTION__)); + NaClSrpcError retval; + retval = NaClSrpcInvokeBySignature( + channel, + "PPB_MouseCursor_SetCursor:iiiC:i", + instance, + type, + custom_image, + hot_spot_bytes, hot_spot, + success + ); + return retval; +} + NaClSrpcError PpbMouseLockRpcClient::PPB_MouseLock_LockMouse( NaClSrpcChannel* channel, PP_Instance instance, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc index d059fca..c7ef961 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_rpc_server.cc @@ -329,79 +329,6 @@ static void PPB_Core_CallOnMainThreadDispatcher( ); } -static void PPB_CursorControl_SetCursorDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PpbCursorControlRpcServer::PPB_CursorControl_SetCursor( - rpc, - done, - inputs[0]->u.ival, - inputs[1]->u.ival, - inputs[2]->u.ival, - inputs[3]->u.count, inputs[3]->arrays.carr, - &(outputs[0]->u.ival) - ); -} - -static void PPB_CursorControl_LockCursorDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PpbCursorControlRpcServer::PPB_CursorControl_LockCursor( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPB_CursorControl_UnlockCursorDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PpbCursorControlRpcServer::PPB_CursorControl_UnlockCursor( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPB_CursorControl_HasCursorLockDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PpbCursorControlRpcServer::PPB_CursorControl_HasCursorLock( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - -static void PPB_CursorControl_CanLockCursorDispatcher( - NaClSrpcRpc* rpc, - NaClSrpcArg** inputs, - NaClSrpcArg** outputs, - NaClSrpcClosure* done -) { - PpbCursorControlRpcServer::PPB_CursorControl_CanLockCursor( - rpc, - done, - inputs[0]->u.ival, - &(outputs[0]->u.ival) - ); -} - static void PPB_FileIO_CreateDispatcher( NaClSrpcRpc* rpc, NaClSrpcArg** inputs, @@ -1634,6 +1561,23 @@ static void PPB_Messaging_PostMessageDispatcher( ); } +static void PPB_MouseCursor_SetCursorDispatcher( + NaClSrpcRpc* rpc, + NaClSrpcArg** inputs, + NaClSrpcArg** outputs, + NaClSrpcClosure* done +) { + PpbMouseCursorRpcServer::PPB_MouseCursor_SetCursor( + rpc, + done, + inputs[0]->u.ival, + inputs[1]->u.ival, + inputs[2]->u.ival, + inputs[3]->u.count, inputs[3]->arrays.carr, + &(outputs[0]->u.ival) + ); +} + static void PPB_MouseLock_LockMouseDispatcher( NaClSrpcRpc* rpc, NaClSrpcArg** inputs, @@ -3188,11 +3132,6 @@ NaClSrpcHandlerDesc PpbRpcs::srpc_methods[] = { { "PPB_Core_GetTime::d", PPB_Core_GetTimeDispatcher }, { "PPB_Core_GetTimeTicks::d", PPB_Core_GetTimeTicksDispatcher }, { "PPB_Core_CallOnMainThread:iii:", PPB_Core_CallOnMainThreadDispatcher }, - { "PPB_CursorControl_SetCursor:iiiC:i", PPB_CursorControl_SetCursorDispatcher }, - { "PPB_CursorControl_LockCursor:i:i", PPB_CursorControl_LockCursorDispatcher }, - { "PPB_CursorControl_UnlockCursor:i:i", PPB_CursorControl_UnlockCursorDispatcher }, - { "PPB_CursorControl_HasCursorLock:i:i", PPB_CursorControl_HasCursorLockDispatcher }, - { "PPB_CursorControl_CanLockCursor:i:i", PPB_CursorControl_CanLockCursorDispatcher }, { "PPB_FileIO_Create:i:i", PPB_FileIO_CreateDispatcher }, { "PPB_FileIO_IsFileIO:i:i", PPB_FileIO_IsFileIODispatcher }, { "PPB_FileIO_Open:iiii:i", PPB_FileIO_OpenDispatcher }, @@ -3272,6 +3211,7 @@ NaClSrpcHandlerDesc PpbRpcs::srpc_methods[] = { { "PPB_Instance_BindGraphics:ii:i", PPB_Instance_BindGraphicsDispatcher }, { "PPB_Instance_IsFullFrame:i:i", PPB_Instance_IsFullFrameDispatcher }, { "PPB_Messaging_PostMessage:iC:", PPB_Messaging_PostMessageDispatcher }, + { "PPB_MouseCursor_SetCursor:iiiC:i", PPB_MouseCursor_SetCursorDispatcher }, { "PPB_MouseLock_LockMouse:ii:i", PPB_MouseLock_LockMouseDispatcher }, { "PPB_MouseLock_UnlockMouse:i:", PPB_MouseLock_UnlockMouseDispatcher }, { "PPB_NetAddress_Private_AreEqual:CC:i", PPB_NetAddress_Private_AreEqualDispatcher }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py b/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py index 62b4779..9876124 100755 --- a/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py +++ b/ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py @@ -61,7 +61,6 @@ all_units = [ 'ppb_audio.srpc', 'ppb_audio_config.srpc', 'ppb_core.srpc', - 'ppb_cursor_control.srpc', 'ppb_file_io.srpc', 'ppb_file_ref.srpc', 'ppb_file_system.srpc', @@ -76,6 +75,7 @@ all_units = [ 'ppb_input_event.srpc', 'ppb_instance.srpc', 'ppb_messaging.srpc', + 'ppb_mouse_cursor.srpc', 'ppb_mouse_lock.srpc', 'ppb_net_address_private.srpc', 'ppb_pdf.srpc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h index 863f907..efd393b 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h @@ -174,43 +174,6 @@ class PpbCoreRpcServer { void operator=(const PpbCoreRpcServer); }; // class PpbCoreRpcServer -class PpbCursorControlRpcServer { - public: - static void PPB_CursorControl_SetCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t type, - PP_Resource custom_image, - nacl_abi_size_t hot_spot_bytes, char* hot_spot, - int32_t* success); - static void PPB_CursorControl_LockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success); - static void PPB_CursorControl_UnlockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success); - static void PPB_CursorControl_HasCursorLock( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success); - static void PPB_CursorControl_CanLockCursor( - NaClSrpcRpc* rpc, - NaClSrpcClosure* done, - PP_Instance instance, - int32_t* success); - - private: - PpbCursorControlRpcServer(); - PpbCursorControlRpcServer(const PpbCursorControlRpcServer&); - void operator=(const PpbCursorControlRpcServer); -}; // class PpbCursorControlRpcServer - class PpbFileIORpcServer { public: static void PPB_FileIO_Create( @@ -846,6 +809,23 @@ class PpbMessagingRpcServer { void operator=(const PpbMessagingRpcServer); }; // class PpbMessagingRpcServer +class PpbMouseCursorRpcServer { + public: + static void PPB_MouseCursor_SetCursor( + NaClSrpcRpc* rpc, + NaClSrpcClosure* done, + PP_Instance instance, + int32_t type, + PP_Resource custom_image, + nacl_abi_size_t hot_spot_bytes, char* hot_spot, + int32_t* success); + + private: + PpbMouseCursorRpcServer(); + PpbMouseCursorRpcServer(const PpbMouseCursorRpcServer&); + void operator=(const PpbMouseCursorRpcServer); +}; // class PpbMouseCursorRpcServer + class PpbMouseLockRpcServer { public: static void PPB_MouseLock_LockMouse( diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h index 288455f..a54103b 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h @@ -153,38 +153,6 @@ class PpbCoreRpcClient { void operator=(const PpbCoreRpcClient); }; // class PpbCoreRpcClient -class PpbCursorControlRpcClient { - public: - static NaClSrpcError PPB_CursorControl_SetCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t type, - PP_Resource custom_image, - nacl_abi_size_t hot_spot_bytes, char* hot_spot, - int32_t* success); - static NaClSrpcError PPB_CursorControl_LockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success); - static NaClSrpcError PPB_CursorControl_UnlockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success); - static NaClSrpcError PPB_CursorControl_HasCursorLock( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success); - static NaClSrpcError PPB_CursorControl_CanLockCursor( - NaClSrpcChannel* channel, - PP_Instance instance, - int32_t* success); - - private: - PpbCursorControlRpcClient(); - PpbCursorControlRpcClient(const PpbCursorControlRpcClient&); - void operator=(const PpbCursorControlRpcClient); -}; // class PpbCursorControlRpcClient - class PpbFileIORpcClient { public: static NaClSrpcError PPB_FileIO_Create( @@ -741,6 +709,22 @@ class PpbMessagingRpcClient { void operator=(const PpbMessagingRpcClient); }; // class PpbMessagingRpcClient +class PpbMouseCursorRpcClient { + public: + static NaClSrpcError PPB_MouseCursor_SetCursor( + NaClSrpcChannel* channel, + PP_Instance instance, + int32_t type, + PP_Resource custom_image, + nacl_abi_size_t hot_spot_bytes, char* hot_spot, + int32_t* success); + + private: + PpbMouseCursorRpcClient(); + PpbMouseCursorRpcClient(const PpbMouseCursorRpcClient&); + void operator=(const PpbMouseCursorRpcClient); +}; // class PpbMouseCursorRpcClient + class PpbMouseLockRpcClient { public: static NaClSrpcError PPB_MouseLock_LockMouse( diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc index 964b1f3..6cbd907 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc +++ b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc @@ -12,12 +12,11 @@ #include "native_client/src/shared/ppapi_proxy/plugin_nacl_file.h" #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" #include "native_client/tests/ppapi_test_lib/test_interface.h" +#include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_core.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" - namespace { //////////////////////////////////////////////////////////////////////////////// @@ -25,11 +24,7 @@ namespace { //////////////////////////////////////////////////////////////////////////////// void TestGetDevInterfaces() { - // This test is run as a simple embedded .nexe with --enable-nacl. It should - // have access to all dev interfaces. Only test one to make the test more - // robust as interfaces change. - EXPECT(GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE) != NULL); - + // TODO(brettw) remove this test. TEST_PASSED; } diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc index 42376a1..c4c419a 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc @@ -4,7 +4,6 @@ #include "native_client/src/shared/platform/nacl_check.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" @@ -24,6 +23,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" @@ -118,6 +118,11 @@ const PPB_Messaging* PPBMessaging() { GetBrowserInterfaceSafe(PPB_MESSAGING_INTERFACE)); } +const PPB_MouseCursor_1_0* PPBMouseCursor() { + return reinterpret_cast<const PPB_MouseCursor_1_0*>( + GetBrowserInterfaceSafe(PPB_MOUSECURSOR_INTERFACE_1_0)); +} + const PPB_MouseInputEvent* PPBMouseInputEvent() { return reinterpret_cast<const PPB_MouseInputEvent*>( GetBrowserInterfaceSafe(PPB_MOUSE_INPUT_EVENT_INTERFACE)); @@ -156,12 +161,6 @@ const PPB_WheelInputEvent* PPBWheelInputEvent() { // Dev interfaces. -const PPB_CursorControl_Dev* PPBCursorControlDev() { - return reinterpret_cast<const PPB_CursorControl_Dev*>( - // Change to GetBrowserInterfaceSafe when moving out of dev. - GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE)); -} - const PPB_Font_Dev* PPBFontDev() { return reinterpret_cast<const PPB_Font_Dev*>( // Change to GetBrowserInterfaceSafe when moving out of dev. diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h index 300d92d..30266a2 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h @@ -21,13 +21,13 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" #include "ppapi/c/ppb_view.h" -#include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" @@ -58,6 +58,7 @@ const PPB_InputEvent* PPBInputEvent(); const PPB_Instance* PPBInstance(); const PPB_KeyboardInputEvent* PPBKeyboardInputEvent(); const PPB_Messaging* PPBMessaging(); +const PPB_MouseCursor* PPBMouseCursor(); const PPB_MouseInputEvent* PPBMouseInputEvent(); const PPB_OpenGLES2* PPBOpenGLES2(); const PPB_URLLoader* PPBURLLoader(); @@ -72,7 +73,6 @@ const PPB_WheelInputEvent* PPBWheelInputEvent(); // Lookup returns NULL if the interface is not available. // -const PPB_CursorControl_Dev* PPBCursorControlDev(); const PPB_Font_Dev* PPBFontDev(); const PPB_Memory_Dev* PPBMemoryDev(); const PPB_Scrollbar_Dev* PPBScrollbarDev(); diff --git a/ppapi/native_client/tests/ppapi_tests/nacl.scons b/ppapi/native_client/tests/ppapi_tests/nacl.scons index b590a84..50edb2d 100644 --- a/ppapi/native_client/tests/ppapi_tests/nacl.scons +++ b/ppapi/native_client/tests/ppapi_tests/nacl.scons @@ -37,7 +37,6 @@ ppapi_tests_sources = [ #'test_buffer.cc', # Not yet proxied. #'test_char_set.cc', - 'test_cursor_control.cc', # Fails in DeleteDirectoryRecursively. # BUG: http://code.google.com/p/nativeclient/issues/detail?id=2107 #'test_directory_reader.cc', @@ -45,6 +44,7 @@ ppapi_tests_sources = [ 'test_file_ref.cc', 'test_file_system.cc', 'test_memory.cc', + 'test_mouse_cursor.cc', 'test_graphics_2d.cc', 'test_image_data.cc', 'test_paint_aggregator.cc', |