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 Thu Dec 20 13:10:26 2012.
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/ppb_instance_api.h"
12 #include "ppapi/thunk/ppb_widget_api.h"
13 #include "ppapi/thunk/resource_creation_api.h"
14 #include "ppapi/thunk/thunk.h"
21 PP_Bool
IsWidget(PP_Resource resource
) {
22 VLOG(4) << "PPB_Widget_Dev::IsWidget()";
23 EnterResource
<PPB_Widget_API
> enter(resource
, false);
24 return PP_FromBool(enter
.succeeded());
27 PP_Bool
Paint(PP_Resource widget
,
28 const struct PP_Rect
* rect
,
30 VLOG(4) << "PPB_Widget_Dev::Paint()";
31 EnterResource
<PPB_Widget_API
> enter(widget
, false);
34 return enter
.object()->Paint(rect
, image
);
37 PP_Bool
HandleEvent(PP_Resource widget
, PP_Resource input_event
) {
38 VLOG(4) << "PPB_Widget_Dev::HandleEvent()";
39 EnterResource
<PPB_Widget_API
> enter(widget
, false);
42 return enter
.object()->HandleEvent(input_event
);
45 PP_Bool
GetLocation(PP_Resource widget
, struct PP_Rect
* location
) {
46 VLOG(4) << "PPB_Widget_Dev::GetLocation()";
47 EnterResource
<PPB_Widget_API
> enter(widget
, false);
50 return enter
.object()->GetLocation(location
);
53 void SetLocation(PP_Resource widget
, const struct PP_Rect
* location
) {
54 VLOG(4) << "PPB_Widget_Dev::SetLocation()";
55 EnterResource
<PPB_Widget_API
> enter(widget
, false);
56 if (enter
.succeeded())
57 enter
.object()->SetLocation(location
);
60 void SetScale(PP_Resource widget
, float scale
) {
61 VLOG(4) << "PPB_Widget_Dev::SetScale()";
62 EnterResource
<PPB_Widget_API
> enter(widget
, false);
63 if (enter
.succeeded())
64 enter
.object()->SetScale(scale
);
67 const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3
= {
75 const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4
= {
86 const PPB_Widget_Dev_0_3
* GetPPB_Widget_Dev_0_3_Thunk() {
87 return &g_ppb_widget_dev_thunk_0_3
;
90 const PPB_Widget_Dev_0_4
* GetPPB_Widget_Dev_0_4_Thunk() {
91 return &g_ppb_widget_dev_thunk_0_4
;