Whitelist window states to persist on ASH app windows.
[chromium-blink-merge.git] / ppapi / thunk / ppb_audio_thunk.cc
blob5dddb891784757b4b5dc1c83d76b68ad48a49b9b
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 ppb_audio.idl modified Thu Dec 20 13:10:26 2012.
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_audio.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_audio_api.h"
12 #include "ppapi/thunk/ppb_instance_api.h"
13 #include "ppapi/thunk/resource_creation_api.h"
14 #include "ppapi/thunk/thunk.h"
16 namespace ppapi {
17 namespace thunk {
19 namespace {
21 PP_Resource Create(PP_Instance instance,
22 PP_Resource config,
23 PPB_Audio_Callback audio_callback,
24 void* user_data) {
25 VLOG(4) << "PPB_Audio::Create()";
26 EnterResourceCreation enter(instance);
27 if (enter.failed())
28 return 0;
29 return enter.functions()->CreateAudio(instance,
30 config,
31 audio_callback,
32 user_data);
35 PP_Bool IsAudio(PP_Resource resource) {
36 VLOG(4) << "PPB_Audio::IsAudio()";
37 EnterResource<PPB_Audio_API> enter(resource, false);
38 return PP_FromBool(enter.succeeded());
41 PP_Resource GetCurrentConfig(PP_Resource audio) {
42 VLOG(4) << "PPB_Audio::GetCurrentConfig()";
43 EnterResource<PPB_Audio_API> enter(audio, true);
44 if (enter.failed())
45 return 0;
46 return enter.object()->GetCurrentConfig();
49 PP_Bool StartPlayback(PP_Resource audio) {
50 VLOG(4) << "PPB_Audio::StartPlayback()";
51 EnterResource<PPB_Audio_API> enter(audio, true);
52 if (enter.failed())
53 return PP_FALSE;
54 return enter.object()->StartPlayback();
57 PP_Bool StopPlayback(PP_Resource audio) {
58 VLOG(4) << "PPB_Audio::StopPlayback()";
59 EnterResource<PPB_Audio_API> enter(audio, true);
60 if (enter.failed())
61 return PP_FALSE;
62 return enter.object()->StopPlayback();
65 const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = {
66 &Create,
67 &IsAudio,
68 &GetCurrentConfig,
69 &StartPlayback,
70 &StopPlayback
73 } // namespace
75 const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() {
76 return &g_ppb_audio_thunk_1_0;
79 } // namespace thunk
80 } // namespace ppapi