| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/thunk/thunk.h" | 5 // From dev/ppb_widget_dev.idl modified Fri Nov 16 11:26:06 2012. |
| 6 |
| 7 #include "ppapi/c/dev/ppb_widget_dev.h" |
| 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/shared_impl/tracked_callback.h" |
| 6 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
| 11 #include "ppapi/thunk/ppb_instance_api.h" |
| 7 #include "ppapi/thunk/ppb_widget_api.h" | 12 #include "ppapi/thunk/ppb_widget_api.h" |
| 8 #include "ppapi/thunk/resource_creation_api.h" | 13 #include "ppapi/thunk/resource_creation_api.h" |
| 14 #include "ppapi/thunk/thunk.h" |
| 9 | 15 |
| 10 namespace ppapi { | 16 namespace ppapi { |
| 11 namespace thunk { | 17 namespace thunk { |
| 12 | 18 |
| 13 namespace { | 19 namespace { |
| 14 | 20 |
| 15 PP_Bool IsWidget(PP_Resource resource) { | 21 PP_Bool IsWidget(PP_Resource resource) { |
| 16 EnterResource<PPB_Widget_API> enter(resource, false); | 22 EnterResource<PPB_Widget_API> enter(resource, false); |
| 17 return PP_FromBool(enter.succeeded()); | 23 return PP_FromBool(enter.succeeded()); |
| 18 } | 24 } |
| 19 | 25 |
| 20 PP_Bool Paint(PP_Resource widget, const PP_Rect* rect, PP_Resource image_id) { | 26 PP_Bool Paint(PP_Resource widget, |
| 27 const struct PP_Rect* rect, |
| 28 PP_Resource image) { |
| 21 EnterResource<PPB_Widget_API> enter(widget, false); | 29 EnterResource<PPB_Widget_API> enter(widget, false); |
| 22 if (enter.failed()) | 30 if (enter.failed()) |
| 23 return PP_FALSE; | 31 return PP_FALSE; |
| 24 return enter.object()->Paint(rect, image_id); | 32 return enter.object()->Paint(rect, image); |
| 25 } | 33 } |
| 26 | 34 |
| 27 PP_Bool HandleEvent(PP_Resource widget, PP_Resource pp_input_event) { | 35 PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) { |
| 28 EnterResource<PPB_Widget_API> enter(widget, false); | 36 EnterResource<PPB_Widget_API> enter(widget, false); |
| 29 if (enter.failed()) | 37 if (enter.failed()) |
| 30 return PP_FALSE; | 38 return PP_FALSE; |
| 31 return enter.object()->HandleEvent(pp_input_event); | 39 return enter.object()->HandleEvent(input_event); |
| 32 } | 40 } |
| 33 | 41 |
| 34 PP_Bool GetLocation(PP_Resource widget, PP_Rect* location) { | 42 PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) { |
| 35 EnterResource<PPB_Widget_API> enter(widget, false); | 43 EnterResource<PPB_Widget_API> enter(widget, false); |
| 36 if (enter.failed()) | 44 if (enter.failed()) |
| 37 return PP_FALSE; | 45 return PP_FALSE; |
| 38 return enter.object()->GetLocation(location); | 46 return enter.object()->GetLocation(location); |
| 39 } | 47 } |
| 40 | 48 |
| 41 void SetLocation(PP_Resource widget, const PP_Rect* location) { | 49 void SetLocation(PP_Resource widget, const struct PP_Rect* location) { |
| 42 EnterResource<PPB_Widget_API> enter(widget, false); | 50 EnterResource<PPB_Widget_API> enter(widget, false); |
| 43 if (enter.succeeded()) | 51 if (enter.succeeded()) |
| 44 enter.object()->SetLocation(location); | 52 enter.object()->SetLocation(location); |
| 45 } | 53 } |
| 46 | 54 |
| 47 void SetScale(PP_Resource widget, float scale) { | 55 void SetScale(PP_Resource widget, float scale) { |
| 48 EnterResource<PPB_Widget_API> enter(widget, false); | 56 EnterResource<PPB_Widget_API> enter(widget, false); |
| 49 if (enter.succeeded()) | 57 if (enter.succeeded()) |
| 50 enter.object()->SetScale(scale); | 58 enter.object()->SetScale(scale); |
| 51 } | 59 } |
| 52 | 60 |
| 53 const PPB_Widget_Dev_0_3 g_ppb_widget_thunk_0_3 = { | 61 const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = { |
| 54 &IsWidget, | 62 &IsWidget, |
| 55 &Paint, | 63 &Paint, |
| 56 &HandleEvent, | 64 &HandleEvent, |
| 57 &GetLocation, | 65 &GetLocation, |
| 58 &SetLocation, | 66 &SetLocation, |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 const PPB_Widget_Dev_0_4 g_ppb_widget_thunk_0_4 = { | 69 const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 = { |
| 62 &IsWidget, | 70 &IsWidget, |
| 63 &Paint, | 71 &Paint, |
| 64 &HandleEvent, | 72 &HandleEvent, |
| 65 &GetLocation, | 73 &GetLocation, |
| 66 &SetLocation, | 74 &SetLocation, |
| 67 &SetScale | 75 &SetScale, |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 } // namespace | 78 } // namespace |
| 71 | 79 |
| 72 const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() { | 80 const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() { |
| 73 return &g_ppb_widget_thunk_0_3; | 81 return &g_ppb_widget_dev_thunk_0_3; |
| 74 } | 82 } |
| 75 | 83 |
| 76 const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() { | 84 const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() { |
| 77 return &g_ppb_widget_thunk_0_4; | 85 return &g_ppb_widget_dev_thunk_0_4; |
| 78 } | 86 } |
| 79 | 87 |
| 80 } // namespace thunk | 88 } // namespace thunk |
| 81 } // namespace ppapi | 89 } // namespace ppapi |
| OLD | NEW |