| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "webkit/glue/plugins/pepper_cursor_control.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/ref_counted.h" | |
| 9 #include "ppapi/c/dev/pp_cursor_type_dev.h" | |
| 10 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | |
| 11 #include "ppapi/c/pp_point.h" | |
| 12 #include "ppapi/c/pp_resource.h" | |
| 13 #include "webkit/glue/plugins/pepper_common.h" | |
| 14 #include "webkit/glue/plugins/pepper_image_data.h" | |
| 15 #include "webkit/glue/plugins/pepper_plugin_instance.h" | |
| 16 #include "webkit/glue/plugins/pepper_resource.h" | |
| 17 | |
| 18 namespace pepper { | |
| 19 | |
| 20 namespace { | |
| 21 | |
| 22 PP_Bool SetCursor(PP_Instance instance_id, | |
| 23 PP_CursorType_Dev type, | |
| 24 PP_Resource custom_image_id, | |
| 25 const PP_Point* hot_spot) { | |
| 26 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
| 27 if (!instance) | |
| 28 return PP_FALSE; | |
| 29 | |
| 30 scoped_refptr<ImageData> custom_image( | |
| 31 Resource::GetAs<ImageData>(custom_image_id)); | |
| 32 if (custom_image.get()) { | |
| 33 // TODO(neb): implement custom cursors. | |
| 34 NOTIMPLEMENTED(); | |
| 35 return PP_FALSE; | |
| 36 } | |
| 37 | |
| 38 return BoolToPPBool(instance->SetCursor(type)); | |
| 39 } | |
| 40 | |
| 41 PP_Bool LockCursor(PP_Instance instance_id) { | |
| 42 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
| 43 if (!instance) | |
| 44 return PP_FALSE; | |
| 45 | |
| 46 // TODO(neb): implement cursor locking. | |
| 47 return PP_FALSE; | |
| 48 } | |
| 49 | |
| 50 PP_Bool UnlockCursor(PP_Instance instance_id) { | |
| 51 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
| 52 if (!instance) | |
| 53 return PP_FALSE; | |
| 54 | |
| 55 // TODO(neb): implement cursor locking. | |
| 56 return PP_FALSE; | |
| 57 } | |
| 58 | |
| 59 PP_Bool HasCursorLock(PP_Instance instance_id) { | |
| 60 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
| 61 if (!instance) | |
| 62 return PP_FALSE; | |
| 63 | |
| 64 // TODO(neb): implement cursor locking. | |
| 65 return PP_FALSE; | |
| 66 } | |
| 67 | |
| 68 PP_Bool CanLockCursor(PP_Instance instance_id) { | |
| 69 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
| 70 if (!instance) | |
| 71 return PP_FALSE; | |
| 72 | |
| 73 // TODO(neb): implement cursor locking. | |
| 74 return PP_FALSE; | |
| 75 } | |
| 76 | |
| 77 const PPB_CursorControl_Dev cursor_control_interface = { | |
| 78 &SetCursor, | |
| 79 &LockCursor, | |
| 80 &UnlockCursor, | |
| 81 &HasCursorLock, | |
| 82 &CanLockCursor | |
| 83 }; | |
| 84 | |
| 85 } // namespace | |
| 86 | |
| 87 const PPB_CursorControl_Dev* GetCursorControlInterface() { | |
| 88 return &cursor_control_interface; | |
| 89 } | |
| 90 | |
| 91 } // namespace pepper | |
| 92 | |
| OLD | NEW |