Roll Syzygy deps to 0.8.6.4.
[chromium-blink-merge.git] / ppapi / thunk / ppb_camera_device_private_thunk.cc
blob94b3129ddedf6f5fa2e0213cf347412746f9b3b0
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 private/ppb_camera_device_private.idl modified Wed Feb 18 16:44:52 2015.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_camera_device_private.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_camera_device_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance) {
21 VLOG(4) << "PPB_CameraDevice_Private::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateCameraDevicePrivate(instance);
28 PP_Bool IsCameraDevice(PP_Resource resource) {
29 VLOG(4) << "PPB_CameraDevice_Private::IsCameraDevice()";
30 EnterResource<PPB_CameraDevice_API> enter(resource, false);
31 return PP_FromBool(enter.succeeded());
34 int32_t Open(PP_Resource camera_device,
35 struct PP_Var device_id,
36 struct PP_CompletionCallback callback) {
37 VLOG(4) << "PPB_CameraDevice_Private::Open()";
38 EnterResource<PPB_CameraDevice_API> enter(camera_device, callback, true);
39 if (enter.failed())
40 return enter.retval();
41 return enter.SetResult(enter.object()->Open(device_id, enter.callback()));
44 void Close(PP_Resource camera_device) {
45 VLOG(4) << "PPB_CameraDevice_Private::Close()";
46 EnterResource<PPB_CameraDevice_API> enter(camera_device, true);
47 if (enter.failed())
48 return;
49 enter.object()->Close();
52 int32_t GetCameraCapabilities(PP_Resource camera_device,
53 PP_Resource* capabilities,
54 struct PP_CompletionCallback callback) {
55 VLOG(4) << "PPB_CameraDevice_Private::GetCameraCapabilities()";
56 EnterResource<PPB_CameraDevice_API> enter(camera_device, callback, true);
57 if (enter.failed())
58 return enter.retval();
59 return enter.SetResult(
60 enter.object()->GetCameraCapabilities(capabilities, enter.callback()));
63 const PPB_CameraDevice_Private_0_1 g_ppb_cameradevice_private_thunk_0_1 =
64 {&Create, &IsCameraDevice, &Open, &Close, &GetCameraCapabilities};
66 } // namespace
68 PPAPI_THUNK_EXPORT const PPB_CameraDevice_Private_0_1*
69 GetPPB_CameraDevice_Private_0_1_Thunk() {
70 return &g_ppb_cameradevice_private_thunk_0_1;
73 } // namespace thunk
74 } // namespace ppapi