| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/c/private/ppb_talk_private.h" | 6 #include "ppapi/c/private/ppb_talk_private.h" |
| 7 #include "ppapi/shared_impl/tracked_callback.h" | 7 #include "ppapi/shared_impl/tracked_callback.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_talk_private_api.h" | 9 #include "ppapi/thunk/ppb_talk_private_api.h" |
| 10 #include "ppapi/thunk/thunk.h" | 10 #include "ppapi/thunk/thunk.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 int32_t GetPermission(PP_Resource resource, | 24 int32_t GetPermission(PP_Resource resource, |
| 25 PP_CompletionCallback callback) { | 25 PP_CompletionCallback callback) { |
| 26 EnterResource<PPB_Talk_Private_API> enter(resource, callback, true); | 26 EnterResource<PPB_Talk_Private_API> enter(resource, callback, true); |
| 27 if (enter.failed()) | 27 if (enter.failed()) |
| 28 return PP_ERROR_BADRESOURCE; | 28 return PP_ERROR_BADRESOURCE; |
| 29 return enter.SetResult(enter.object()->GetPermission(enter.callback())); | 29 return enter.SetResult(enter.object()->GetPermission(enter.callback())); |
| 30 } | 30 } |
| 31 | 31 |
| 32 const PPB_Talk_Private_1_0 g_ppb_talk_private_thunk = { | 32 int32_t GetRemotingPermission(PP_Resource resource, |
| 33 PP_CompletionCallback callback) { |
| 34 EnterResource<PPB_Talk_Private_API> enter(resource, callback, true); |
| 35 if (enter.failed()) |
| 36 return PP_ERROR_BADRESOURCE; |
| 37 return enter.SetResult( |
| 38 enter.object()->GetRemotingPermission(enter.callback())); |
| 39 } |
| 40 |
| 41 int32_t GetRemotingContinuePermission(PP_Resource resource, |
| 42 PP_CompletionCallback callback) { |
| 43 EnterResource<PPB_Talk_Private_API> enter(resource, callback, true); |
| 44 if (enter.failed()) |
| 45 return PP_ERROR_BADRESOURCE; |
| 46 return enter.SetResult( |
| 47 enter.object()->GetRemotingContinuePermission(enter.callback())); |
| 48 } |
| 49 |
| 50 int32_t StartRemoting(PP_Resource resource, |
| 51 PP_TalkEventCallback event_callback, |
| 52 void* user_data) { |
| 53 EnterResource<PPB_Talk_Private_API> enter(resource, true); |
| 54 if (enter.failed()) |
| 55 return PP_ERROR_BADRESOURCE; |
| 56 return enter.object()->StartRemoting(event_callback, user_data); |
| 57 } |
| 58 |
| 59 void StopRemoting(PP_Resource resource) { |
| 60 EnterResource<PPB_Talk_Private_API> enter(resource, true); |
| 61 if (enter.succeeded()) |
| 62 return enter.object()->StopRemoting(); |
| 63 } |
| 64 |
| 65 const PPB_Talk_Private_1_0 g_ppb_talk_private_thunk_1_0 = { |
| 33 &Create, | 66 &Create, |
| 34 &GetPermission | 67 &GetPermission |
| 35 }; | 68 }; |
| 36 | 69 |
| 70 const PPB_Talk_Private_2_0 g_ppb_talk_private_thunk_2_0 = { |
| 71 &Create, |
| 72 &GetPermission, |
| 73 &GetRemotingPermission, |
| 74 &GetRemotingContinuePermission, |
| 75 &StartRemoting, |
| 76 &StopRemoting |
| 77 }; |
| 78 |
| 37 } // namespace | 79 } // namespace |
| 38 | 80 |
| 39 const PPB_Talk_Private_1_0* GetPPB_Talk_Private_1_0_Thunk() { | 81 const PPB_Talk_Private_1_0* GetPPB_Talk_Private_1_0_Thunk() { |
| 40 return &g_ppb_talk_private_thunk; | 82 return &g_ppb_talk_private_thunk_1_0; |
| 83 } |
| 84 |
| 85 const PPB_Talk_Private_2_0* GetPPB_Talk_Private_2_0_Thunk() { |
| 86 return &g_ppb_talk_private_thunk_2_0; |
| 41 } | 87 } |
| 42 | 88 |
| 43 } // namespace thunk | 89 } // namespace thunk |
| 44 } // namespace ppapi | 90 } // namespace ppapi |
| OLD | NEW |