Revert of Revert of "Remove SSLClientAuthHandler's RDH dependency." (https://coderevi...
[chromium-blink-merge.git] / ppapi / thunk / ppb_image_capture_private_thunk.cc
blobae88783cf5aa2c781f40d5515298a2876eb86e63
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_image_capture_private.idl modified Wed Nov 5 14:29:15 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_image_capture_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_image_capture_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance,
21 struct PP_Var camera_source_id,
22 PPB_ImageCapture_Private_ErrorCallback error_callback,
23 void* user_data) {
24 VLOG(4) << "PPB_ImageCapture_Private::Create()";
25 EnterResourceCreation enter(instance);
26 if (enter.failed())
27 return 0;
28 return enter.functions()->CreateImageCapturePrivate(
29 instance, camera_source_id, error_callback, user_data);
32 PP_Bool IsImageCapture(PP_Resource resource) {
33 VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()";
34 EnterResource<PPB_ImageCapture_API> enter(resource, false);
35 return PP_FromBool(enter.succeeded());
38 int32_t Close(PP_Resource resource, struct PP_CompletionCallback callback) {
39 VLOG(4) << "PPB_ImageCapture_Private::Close()";
40 EnterResource<PPB_ImageCapture_API> enter(resource, callback, true);
41 if (enter.failed())
42 return enter.retval();
43 return enter.SetResult(enter.object()->Close(enter.callback()));
46 int32_t SetConfig(PP_Resource image_capture,
47 PP_Resource config,
48 struct PP_CompletionCallback callback) {
49 VLOG(4) << "PPB_ImageCapture_Private::SetConfig()";
50 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
51 if (enter.failed())
52 return enter.retval();
53 return enter.SetResult(enter.object()->SetConfig(config, enter.callback()));
56 int32_t GetConfig(PP_Resource image_capture,
57 PP_Resource* config,
58 struct PP_CompletionCallback callback) {
59 VLOG(4) << "PPB_ImageCapture_Private::GetConfig()";
60 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
61 if (enter.failed())
62 return enter.retval();
63 return enter.SetResult(enter.object()->GetConfig(config, enter.callback()));
66 int32_t GetCameraCapabilities(PP_Resource image_capture,
67 PP_Resource* capabilities,
68 struct PP_CompletionCallback callback) {
69 VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()";
70 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true);
71 if (enter.failed())
72 return enter.retval();
73 return enter.SetResult(
74 enter.object()->GetCameraCapabilities(capabilities, enter.callback()));
77 int32_t CaptureStillImage(
78 PP_Resource image_capture,
79 PPB_ImageCapture_Private_ShutterCallback shutter_callback,
80 PPB_ImageCapture_Private_PreviewCallback preview_callback,
81 PPB_ImageCapture_Private_JpegCallback jpeg_callback,
82 int64_t* sequence_id) {
83 VLOG(4) << "PPB_ImageCapture_Private::CaptureStillImage()";
84 EnterResource<PPB_ImageCapture_API> enter(image_capture, true);
85 if (enter.failed())
86 return enter.retval();
87 return enter.object()->CaptureStillImage(shutter_callback, preview_callback,
88 jpeg_callback, sequence_id);
91 const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = {
92 &Create,
93 &IsImageCapture,
94 &Close,
95 &SetConfig,
96 &GetConfig,
97 &GetCameraCapabilities,
98 &CaptureStillImage};
100 } // namespace
102 PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1*
103 GetPPB_ImageCapture_Private_0_1_Thunk() {
104 return &g_ppb_imagecapture_private_thunk_0_1;
107 } // namespace thunk
108 } // namespace ppapi