Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 9814015: Add new MouseCursor interface for setting the mouse cursor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/shared_impl/ppb_instance_shared.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_instance_proxy.cc
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 758e67f3dc1edeea5c82fbd5153c9b903ec2ad0b..d4a2e456a7a5018becb299ec4ff54e970eef95bf 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -124,6 +124,8 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnHostMsgGetDocumentURL)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL,
OnHostMsgGetPluginInstanceURL)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor,
+ OnHostMsgSetCursor)
// Host -> Plugin messages.
IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete,
@@ -403,6 +405,32 @@ void PPB_Instance_Proxy::PostMessage(PP_Instance instance,
instance, SerializedVarSendInput(dispatcher(), message)));
}
+PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
+ PP_MouseCursor_Type type,
+ PP_Resource image,
+ const PP_Point* hot_spot) {
+ // Some of these parameters are important for security. This check is in the
+ // plugin process just for the convenience of the caller (since we don't
+ // bother returning errors from the other process with a sync message). The
+ // parameters will be validated again in the renderer.
+ if (!ValidateSetCursorParams(type, image, hot_spot))
+ return PP_FALSE;
+
+ HostResource image_host_resource;
+ if (image) {
+ Resource* cursor_image =
+ PpapiGlobals::Get()->GetResourceTracker()->GetResource(image);
+ if (!cursor_image || cursor_image->pp_instance() != instance)
+ return PP_FALSE;
+ image_host_resource = cursor_image->host_resource();
+ }
+
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetCursor(
+ API_ID_PPB_INSTANCE, instance, static_cast<int32_t>(type),
+ image_host_resource, hot_spot ? *hot_spot : PP_MakePoint(0, 0)));
+ return PP_TRUE;
+}
+
int32_t PPB_Instance_Proxy::LockMouse(PP_Instance instance,
PP_CompletionCallback callback) {
if (!callback.func)
@@ -637,6 +665,19 @@ void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL(
}
}
+void PPB_Instance_Proxy::OnHostMsgSetCursor(
+ PP_Instance instance,
+ int32_t type,
+ const ppapi::HostResource& custom_image,
+ const PP_Point& hot_spot) {
+ EnterInstanceNoLock enter(instance, true);
+ if (enter.succeeded()) {
+ enter.functions()->SetCursor(
+ instance, static_cast<PP_MouseCursor_Type>(type),
+ custom_image.host_resource(), &hot_spot);
+ }
+}
+
void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance,
int32_t result) {
// Save the mouse callback on the instance data.
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/shared_impl/ppb_instance_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698