• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 // From dev/ppb_widget_dev.idl modified Tue Aug 20 08:13:36 2013.
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"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_widget_api.h"
13 
14 namespace ppapi {
15 namespace thunk {
16 
17 namespace {
18 
IsWidget(PP_Resource resource)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());
23 }
24 
Paint(PP_Resource widget,const struct PP_Rect * rect,PP_Resource image)25 PP_Bool Paint(PP_Resource widget,
26               const struct PP_Rect* rect,
27               PP_Resource image) {
28   VLOG(4) << "PPB_Widget_Dev::Paint()";
29   EnterResource<PPB_Widget_API> enter(widget, false);
30   if (enter.failed())
31     return PP_FALSE;
32   return enter.object()->Paint(rect, image);
33 }
34 
HandleEvent(PP_Resource widget,PP_Resource input_event)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);
38   if (enter.failed())
39     return PP_FALSE;
40   return enter.object()->HandleEvent(input_event);
41 }
42 
GetLocation(PP_Resource widget,struct PP_Rect * location)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);
46   if (enter.failed())
47     return PP_FALSE;
48   return enter.object()->GetLocation(location);
49 }
50 
SetLocation(PP_Resource widget,const struct PP_Rect * 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);
54   if (enter.failed())
55     return;
56   enter.object()->SetLocation(location);
57 }
58 
SetScale(PP_Resource widget,float scale)59 void SetScale(PP_Resource widget, float scale) {
60   VLOG(4) << "PPB_Widget_Dev::SetScale()";
61   EnterResource<PPB_Widget_API> enter(widget, false);
62   if (enter.failed())
63     return;
64   enter.object()->SetScale(scale);
65 }
66 
67 const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {
68   &IsWidget,
69   &Paint,
70   &HandleEvent,
71   &GetLocation,
72   &SetLocation
73 };
74 
75 const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 = {
76   &IsWidget,
77   &Paint,
78   &HandleEvent,
79   &GetLocation,
80   &SetLocation,
81   &SetScale
82 };
83 
84 }  // namespace
85 
GetPPB_Widget_Dev_0_3_Thunk()86 PPAPI_THUNK_EXPORT const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
87   return &g_ppb_widget_dev_thunk_0_3;
88 }
89 
GetPPB_Widget_Dev_0_4_Thunk()90 PPAPI_THUNK_EXPORT const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
91   return &g_ppb_widget_dev_thunk_0_4;
92 }
93 
94 }  // namespace thunk
95 }  // namespace ppapi
96