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
3 // found in the LICENSE file.
5 // From dev/ppb_widget_dev.idl modified Mon May 6 10:11:29 2013.
7 #include "ppapi/c/dev/ppb_widget_dev.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_widget_api.h"
19 PP_Bool
IsWidget(PP_Resource resource
) {
20 VLOG(4) << "PPB_Widget_Dev::IsWidget()";
21 EnterResource
<PPB_Widget_API
> enter(resource
, false);
22 return PP_FromBool(enter
.succeeded());
25 PP_Bool
Paint(PP_Resource widget
,
26 const struct PP_Rect
* rect
,
28 VLOG(4) << "PPB_Widget_Dev::Paint()";
29 EnterResource
<PPB_Widget_API
> enter(widget
, false);
32 return enter
.object()->Paint(rect
, image
);
35 PP_Bool
HandleEvent(PP_Resource widget
, PP_Resource input_event
) {
36 VLOG(4) << "PPB_Widget_Dev::HandleEvent()";
37 EnterResource
<PPB_Widget_API
> enter(widget
, false);
40 return enter
.object()->HandleEvent(input_event
);
43 PP_Bool
GetLocation(PP_Resource widget
, struct PP_Rect
* location
) {
44 VLOG(4) << "PPB_Widget_Dev::GetLocation()";
45 EnterResource
<PPB_Widget_API
> enter(widget
, false);
48 return enter
.object()->GetLocation(location
);
51 void SetLocation(PP_Resource widget
, const struct PP_Rect
* location
) {
52 VLOG(4) << "PPB_Widget_Dev::SetLocation()";
53 EnterResource
<PPB_Widget_API
> enter(widget
, false);
56 enter
.object()->SetLocation(location
);
59 void SetScale(PP_Resource widget
, float scale
) {
60 VLOG(4) << "PPB_Widget_Dev::SetScale()";
61 EnterResource
<PPB_Widget_API
> enter(widget
, false);
64 enter
.object()->SetScale(scale
);
67 const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3
= {&IsWidget
,
73 const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4
=
74 {&IsWidget
, &Paint
, &HandleEvent
, &GetLocation
, &SetLocation
, &SetScale
};
78 PPAPI_THUNK_EXPORT
const PPB_Widget_Dev_0_3
* GetPPB_Widget_Dev_0_3_Thunk() {
79 return &g_ppb_widget_dev_thunk_0_3
;
82 PPAPI_THUNK_EXPORT
const PPB_Widget_Dev_0_4
* GetPPB_Widget_Dev_0_4_Thunk() {
83 return &g_ppb_widget_dev_thunk_0_4
;