Make certificate viewer a tab-modal dialog.
[chromium-blink-merge.git] / ppapi / thunk / ppb_audio_trusted_thunk.cc
blob9484d693fcbfe9dd3d70aa332bec5f36f9ba41ee
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 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/trusted/ppb_audio_trusted.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/ppb_audio_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
13 namespace ppapi {
14 namespace thunk {
16 namespace {
18 typedef EnterResource<PPB_Audio_API> EnterAudio;
20 PP_Resource Create(PP_Instance instance_id) {
21 EnterResourceCreation enter(instance_id);
22 if (enter.failed())
23 return 0;
24 return enter.functions()->CreateAudioTrusted(instance_id);
27 int32_t Open(PP_Resource audio_id,
28 PP_Resource config_id,
29 PP_CompletionCallback callback) {
30 EnterAudio enter(audio_id, callback, true);
31 if (enter.failed())
32 return enter.retval();
33 return enter.SetResult(enter.object()->OpenTrusted(config_id,
34 enter.callback()));
37 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
38 EnterAudio enter(audio_id, true);
39 if (enter.failed())
40 return enter.retval();
41 return enter.object()->GetSyncSocket(sync_socket);
44 int32_t GetSharedMemory(PP_Resource audio_id,
45 int* shm_handle,
46 uint32_t* shm_size) {
47 EnterAudio enter(audio_id, true);
48 if (enter.failed())
49 return enter.retval();
50 return enter.object()->GetSharedMemory(shm_handle, shm_size);
53 const PPB_AudioTrusted g_ppb_audio_trusted_thunk = {
54 &Create,
55 &Open,
56 &GetSyncSocket,
57 &GetSharedMemory,
60 } // namespace
62 const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk() {
63 return &g_ppb_audio_trusted_thunk;
66 } // namespace thunk
67 } // namespace ppapi