OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 9 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
10 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 10 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 PP_Bool SetCursor(PP_Instance instance_id, | 23 PP_Bool SetCursor(PP_Instance instance_id, |
24 PP_CursorType_Dev type, | 24 PP_CursorType_Dev type, |
25 PP_Resource custom_image_id, | 25 PP_Resource custom_image_id, |
26 const PP_Point* hot_spot) { | 26 const PP_Point* hot_spot) { |
27 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 27 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
28 if (!instance) | 28 if (!instance) |
29 return PP_FALSE; | 29 return PP_FALSE; |
30 | 30 |
31 scoped_refptr<PPB_ImageData_Impl> custom_image( | 31 return BoolToPPBool(instance->SetCursor(type, custom_image_id, hot_spot)); |
32 Resource::GetAs<PPB_ImageData_Impl>(custom_image_id)); | |
33 if (custom_image.get()) { | |
34 // TODO(neb): implement custom cursors. | |
35 // (Remember that PP_CURSORTYPE_CUSTOM != WebCursorInfo::TypeCustom.) | |
36 NOTIMPLEMENTED(); | |
37 return PP_FALSE; | |
38 } | |
39 | |
40 return BoolToPPBool(instance->SetCursor(type)); | |
41 } | 32 } |
42 | 33 |
43 PP_Bool LockCursor(PP_Instance instance_id) { | 34 PP_Bool LockCursor(PP_Instance instance_id) { |
44 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 35 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
45 if (!instance) | 36 if (!instance) |
46 return PP_FALSE; | 37 return PP_FALSE; |
47 | 38 |
48 // TODO(neb): implement cursor locking. | 39 // TODO(neb): implement cursor locking. |
49 return PP_FALSE; | 40 return PP_FALSE; |
50 } | 41 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }; | 76 }; |
86 | 77 |
87 } // namespace | 78 } // namespace |
88 | 79 |
89 const PPB_CursorControl_Dev* GetCursorControlInterface() { | 80 const PPB_CursorControl_Dev* GetCursorControlInterface() { |
90 return &cursor_control_interface; | 81 return &cursor_control_interface; |
91 } | 82 } |
92 | 83 |
93 } // namespace ppapi | 84 } // namespace ppapi |
94 } // namespace webkit | 85 } // namespace webkit |
95 | |
OLD | NEW |