Don't add an aura tooltip to bubble close buttons on Windows.
[chromium-blink-merge.git] / ppapi / thunk / ppb_media_stream_video_track_thunk.cc
blobd8ee92182f72e45d6df44f987bb53de8fdcf0b96
1 // Copyright 2014 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 ppb_media_stream_video_track.idl modified Thu Sep 18 11:36:39 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_media_stream_video_track.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_media_stream_video_track_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance) {
21 VLOG(4) << "PPB_MediaStreamVideoTrack::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateMediaStreamVideoTrack(instance);
28 PP_Bool IsMediaStreamVideoTrack(PP_Resource resource) {
29 VLOG(4) << "PPB_MediaStreamVideoTrack::IsMediaStreamVideoTrack()";
30 EnterResource<PPB_MediaStreamVideoTrack_API> enter(resource, false);
31 return PP_FromBool(enter.succeeded());
34 int32_t Configure(PP_Resource video_track,
35 const int32_t attrib_list[],
36 struct PP_CompletionCallback callback) {
37 VLOG(4) << "PPB_MediaStreamVideoTrack::Configure()";
38 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, callback,
39 true);
40 if (enter.failed())
41 return enter.retval();
42 return enter.SetResult(
43 enter.object()->Configure(attrib_list, enter.callback()));
46 int32_t GetAttrib(PP_Resource video_track,
47 PP_MediaStreamVideoTrack_Attrib attrib,
48 int32_t* value) {
49 VLOG(4) << "PPB_MediaStreamVideoTrack::GetAttrib()";
50 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
51 if (enter.failed())
52 return enter.retval();
53 return enter.object()->GetAttrib(attrib, value);
56 struct PP_Var GetId(PP_Resource video_track) {
57 VLOG(4) << "PPB_MediaStreamVideoTrack::GetId()";
58 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
59 if (enter.failed())
60 return PP_MakeUndefined();
61 return enter.object()->GetId();
64 PP_Bool HasEnded(PP_Resource video_track) {
65 VLOG(4) << "PPB_MediaStreamVideoTrack::HasEnded()";
66 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
67 if (enter.failed())
68 return PP_TRUE;
69 return enter.object()->HasEnded();
72 int32_t GetFrame(PP_Resource video_track,
73 PP_Resource* frame,
74 struct PP_CompletionCallback callback) {
75 VLOG(4) << "PPB_MediaStreamVideoTrack::GetFrame()";
76 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, callback,
77 true);
78 if (enter.failed())
79 return enter.retval();
80 return enter.SetResult(enter.object()->GetFrame(frame, enter.callback()));
83 int32_t RecycleFrame(PP_Resource video_track, PP_Resource frame) {
84 VLOG(4) << "PPB_MediaStreamVideoTrack::RecycleFrame()";
85 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
86 if (enter.failed())
87 return enter.retval();
88 return enter.object()->RecycleFrame(frame);
91 void Close(PP_Resource video_track) {
92 VLOG(4) << "PPB_MediaStreamVideoTrack::Close()";
93 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
94 if (enter.failed())
95 return;
96 enter.object()->Close();
99 int32_t GetEmptyFrame(PP_Resource video_track,
100 PP_Resource* frame,
101 struct PP_CompletionCallback callback) {
102 VLOG(4) << "PPB_MediaStreamVideoTrack::GetEmptyFrame()";
103 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, callback,
104 true);
105 if (enter.failed())
106 return enter.retval();
107 return enter.SetResult(
108 enter.object()->GetEmptyFrame(frame, enter.callback()));
111 int32_t PutFrame(PP_Resource video_track, PP_Resource frame) {
112 VLOG(4) << "PPB_MediaStreamVideoTrack::PutFrame()";
113 EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true);
114 if (enter.failed())
115 return enter.retval();
116 return enter.object()->PutFrame(frame);
119 const PPB_MediaStreamVideoTrack_0_1 g_ppb_mediastreamvideotrack_thunk_0_1 = {
120 &IsMediaStreamVideoTrack,
121 &Configure,
122 &GetAttrib,
123 &GetId,
124 &HasEnded,
125 &GetFrame,
126 &RecycleFrame,
127 &Close};
129 const PPB_MediaStreamVideoTrack_1_0 g_ppb_mediastreamvideotrack_thunk_1_0 = {
130 &Create,
131 &IsMediaStreamVideoTrack,
132 &Configure,
133 &GetAttrib,
134 &GetId,
135 &HasEnded,
136 &GetFrame,
137 &RecycleFrame,
138 &Close,
139 &GetEmptyFrame,
140 &PutFrame};
142 } // namespace
144 PPAPI_THUNK_EXPORT const PPB_MediaStreamVideoTrack_0_1*
145 GetPPB_MediaStreamVideoTrack_0_1_Thunk() {
146 return &g_ppb_mediastreamvideotrack_thunk_0_1;
149 PPAPI_THUNK_EXPORT const PPB_MediaStreamVideoTrack_1_0*
150 GetPPB_MediaStreamVideoTrack_1_0_Thunk() {
151 return &g_ppb_mediastreamvideotrack_thunk_1_0;
154 } // namespace thunk
155 } // namespace ppapi