Update user pod message to use Smart Lock.
[chromium-blink-merge.git] / ppapi / thunk / ppb_flash_drm_thunk.cc
blob7f9026d3cdee2cff6c7609571d0300de405e5dd7
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 private/ppb_flash_drm.idl modified Mon Apr 7 08:56:43 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_flash_drm.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_flash_drm_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance) {
21 VLOG(4) << "PPB_Flash_DRM::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateFlashDRM(instance);
28 int32_t GetDeviceID(PP_Resource drm,
29 struct PP_Var* id,
30 struct PP_CompletionCallback callback) {
31 VLOG(4) << "PPB_Flash_DRM::GetDeviceID()";
32 EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true);
33 if (enter.failed())
34 return enter.retval();
35 return enter.SetResult(enter.object()->GetDeviceID(id, enter.callback()));
38 PP_Bool GetHmonitor(PP_Resource drm, int64_t* hmonitor) {
39 VLOG(4) << "PPB_Flash_DRM::GetHmonitor()";
40 EnterResource<PPB_Flash_DRM_API> enter(drm, true);
41 if (enter.failed())
42 return PP_FALSE;
43 return enter.object()->GetHmonitor(hmonitor);
46 int32_t GetVoucherFile(PP_Resource drm,
47 PP_Resource* file_ref,
48 struct PP_CompletionCallback callback) {
49 VLOG(4) << "PPB_Flash_DRM::GetVoucherFile()";
50 EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true);
51 if (enter.failed())
52 return enter.retval();
53 return enter.SetResult(
54 enter.object()->GetVoucherFile(file_ref, enter.callback()));
57 int32_t MonitorIsExternal(PP_Resource drm,
58 PP_Bool* is_external,
59 struct PP_CompletionCallback callback) {
60 VLOG(4) << "PPB_Flash_DRM::MonitorIsExternal()";
61 EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true);
62 if (enter.failed())
63 return enter.retval();
64 return enter.SetResult(
65 enter.object()->MonitorIsExternal(is_external, enter.callback()));
68 const PPB_Flash_DRM_1_0 g_ppb_flash_drm_thunk_1_0 = {&Create,
69 &GetDeviceID,
70 &GetHmonitor,
71 &GetVoucherFile};
73 const PPB_Flash_DRM_1_1 g_ppb_flash_drm_thunk_1_1 = {&Create,
74 &GetDeviceID,
75 &GetHmonitor,
76 &GetVoucherFile,
77 &MonitorIsExternal};
79 } // namespace
81 PPAPI_THUNK_EXPORT const PPB_Flash_DRM_1_0* GetPPB_Flash_DRM_1_0_Thunk() {
82 return &g_ppb_flash_drm_thunk_1_0;
85 PPAPI_THUNK_EXPORT const PPB_Flash_DRM_1_1* GetPPB_Flash_DRM_1_1_Thunk() {
86 return &g_ppb_flash_drm_thunk_1_1;
89 } // namespace thunk
90 } // namespace ppapi