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

Unified Diff: ppapi/proxy/ppb_cursor_control_proxy.cc

Issue 6334016: Refactor PPAPI proxy resource handling to maintain which host they came from,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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_cursor_control_proxy.h ('k') | ppapi/proxy/ppb_flash_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_cursor_control_proxy.cc
===================================================================
--- ppapi/proxy/ppb_cursor_control_proxy.cc (revision 72840)
+++ ppapi/proxy/ppb_cursor_control_proxy.cc (working copy)
@@ -1,11 +1,14 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
#include "ppapi/proxy/ppb_cursor_control_proxy.h"
+#include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
namespace pp {
@@ -21,11 +24,24 @@
if (!dispatcher)
return PP_FALSE;
+ // It's legal for the image ID to be null if the type is not custom.
+ HostResource cursor_image_resource;
+ if (type == PP_CURSORTYPE_CUSTOM) {
+ PluginResource* cursor_image = PluginResourceTracker::GetInstance()->
+ GetResourceObject(custom_image_id);
+ if (!cursor_image || cursor_image->instance() != instance_id)
+ return PP_FALSE;
+ cursor_image_resource = cursor_image->host_resource();
+ } else {
+ if (custom_image_id)
+ return PP_FALSE; // Image specified for a predefined type.
+ }
+
PP_Bool result = PP_FALSE;
PP_Point empty_point = { 0, 0 };
dispatcher->Send(new PpapiHostMsg_PPBCursorControl_SetCursor(
INTERFACE_ID_PPB_CURSORCONTROL,
- instance_id, static_cast<int32_t>(type), custom_image_id,
+ instance_id, static_cast<int32_t>(type), cursor_image_resource,
hot_spot ? *hot_spot : empty_point, &result));
return result;
}
@@ -121,11 +137,12 @@
void PPB_CursorControl_Proxy::OnMsgSetCursor(PP_Instance instance,
int32_t type,
- PP_Resource custom_image,
+ HostResource custom_image,
const PP_Point& hot_spot,
PP_Bool* result) {
*result = ppb_cursor_control_target()->SetCursor(
- instance, static_cast<PP_CursorType_Dev>(type), custom_image, &hot_spot);
+ instance, static_cast<PP_CursorType_Dev>(type),
+ custom_image.host_resource(), &hot_spot);
}
void PPB_CursorControl_Proxy::OnMsgLockCursor(PP_Instance instance,
« no previous file with comments | « ppapi/proxy/ppb_cursor_control_proxy.h ('k') | ppapi/proxy/ppb_flash_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698