| 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 "third_party/ppapi/c/pp_cursor_type.h" |
| 10 #include "third_party/ppapi/c/pp_point.h" |
| 11 #include "third_party/ppapi/c/pp_resource.h" |
| 12 #include "third_party/ppapi/c/ppb_cursor_control.h" |
| 13 #include "webkit/glue/plugins/pepper_image_data.h" |
| 14 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
| 15 #include "webkit/glue/plugins/pepper_resource.h" |
| 16 |
| 17 namespace pepper { |
| 18 |
| 19 namespace { |
| 20 |
| 21 bool SetCursor(PP_Instance instance_id, |
| 22 PP_CursorType type, |
| 23 PP_Resource custom_image_id, |
| 24 const PP_Point* hot_spot) { |
| 25 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| 26 if (!instance) |
| 27 return false; |
| 28 |
| 29 scoped_refptr<ImageData> custom_image( |
| 30 Resource::GetAs<ImageData>(custom_image_id)); |
| 31 if (custom_image.get()) { |
| 32 // TODO(neb): implement custom cursors. |
| 33 NOTIMPLEMENTED(); |
| 34 return false; |
| 35 } |
| 36 |
| 37 return instance->SetCursor(type); |
| 38 } |
| 39 |
| 40 bool LockCursor(PP_Instance) { |
| 41 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| 42 if (!instance) |
| 43 return false; |
| 44 |
| 45 // TODO(neb): implement cursor locking. |
| 46 return false; |
| 47 } |
| 48 |
| 49 bool UnlockCursor(PP_Instance) { |
| 50 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| 51 if (!instance) |
| 52 return false; |
| 53 |
| 54 // TODO(neb): implement cursor locking. |
| 55 return false; |
| 56 } |
| 57 |
| 58 bool HasCursorLock(PP_Instance) { |
| 59 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| 60 if (!instance) |
| 61 return false; |
| 62 |
| 63 // TODO(neb): implement cursor locking. |
| 64 return false; |
| 65 } |
| 66 |
| 67 bool CanLockCursor(PP_Instance) { |
| 68 PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); |
| 69 if (!instance) |
| 70 return false; |
| 71 |
| 72 // TODO(neb): implement cursor locking. |
| 73 return false; |
| 74 } |
| 75 |
| 76 const PPB_CursorControl cursor_control_interface = { |
| 77 &SetCursor, |
| 78 &LockCursor, |
| 79 &UnlockCursor, |
| 80 &HasCursorLock, |
| 81 &CanLockCursor |
| 82 }; |
| 83 |
| 84 } // namespace |
| 85 |
| 86 const PPB_CursorControl* GetCursorControlInterface() { |
| 87 return &cursor_control_interface; |
| 88 } |
| 89 |
| 90 } // namespace pepper |
| 91 |
| OLD | NEW |