| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // From private/ppb_image_capture_private.idl, | 5 // From private/ppb_image_capture_private.idl modified Wed Nov 5 14:29:15 2014. |
| 6 // modified Wed Aug 13 17:26:13 2014. | |
| 7 | 6 |
| 8 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/private/ppb_image_capture_private.h" | 9 #include "ppapi/c/private/ppb_image_capture_private.h" |
| 11 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 12 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
| 13 #include "ppapi/thunk/ppapi_thunk_export.h" | 12 #include "ppapi/thunk/ppapi_thunk_export.h" |
| 14 #include "ppapi/thunk/ppb_image_capture_api.h" | 13 #include "ppapi/thunk/ppb_image_capture_api.h" |
| 15 | 14 |
| 16 namespace ppapi { | 15 namespace ppapi { |
| 17 namespace thunk { | 16 namespace thunk { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 PP_Resource Create(PP_Instance instance, | 20 PP_Resource Create(PP_Instance instance, |
| 22 struct PP_Var camera_source_id, | 21 struct PP_Var camera_source_id, |
| 23 PPB_ImageCapture_Private_ErrorCallback error_callback, | 22 PPB_ImageCapture_Private_ErrorCallback error_callback, |
| 24 void* user_data) { | 23 void* user_data) { |
| 25 VLOG(4) << "PPB_ImageCapture_Private::Create()"; | 24 VLOG(4) << "PPB_ImageCapture_Private::Create()"; |
| 26 EnterResourceCreation enter(instance); | 25 EnterResourceCreation enter(instance); |
| 27 if (enter.failed()) | 26 if (enter.failed()) |
| 28 return 0; | 27 return 0; |
| 29 return enter.functions()->CreateImageCapturePrivate(instance, | 28 return enter.functions()->CreateImageCapturePrivate( |
| 30 camera_source_id, | 29 instance, camera_source_id, error_callback, user_data); |
| 31 error_callback, | |
| 32 user_data); | |
| 33 } | 30 } |
| 34 | 31 |
| 35 PP_Bool IsImageCapture(PP_Resource resource) { | 32 PP_Bool IsImageCapture(PP_Resource resource) { |
| 36 VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()"; | 33 VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()"; |
| 37 EnterResource<PPB_ImageCapture_API> enter(resource, false); | 34 EnterResource<PPB_ImageCapture_API> enter(resource, false); |
| 38 return PP_FromBool(enter.succeeded()); | 35 return PP_FromBool(enter.succeeded()); |
| 39 } | 36 } |
| 40 | 37 |
| 41 int32_t Close(PP_Resource resource, struct PP_CompletionCallback callback) { | 38 int32_t Close(PP_Resource resource, struct PP_CompletionCallback callback) { |
| 42 VLOG(4) << "PPB_ImageCapture_Private::Close()"; | 39 VLOG(4) << "PPB_ImageCapture_Private::Close()"; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 66 return enter.SetResult(enter.object()->GetConfig(config, enter.callback())); | 63 return enter.SetResult(enter.object()->GetConfig(config, enter.callback())); |
| 67 } | 64 } |
| 68 | 65 |
| 69 int32_t GetCameraCapabilities(PP_Resource image_capture, | 66 int32_t GetCameraCapabilities(PP_Resource image_capture, |
| 70 PP_Resource* capabilities, | 67 PP_Resource* capabilities, |
| 71 struct PP_CompletionCallback callback) { | 68 struct PP_CompletionCallback callback) { |
| 72 VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()"; | 69 VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()"; |
| 73 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true); | 70 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true); |
| 74 if (enter.failed()) | 71 if (enter.failed()) |
| 75 return enter.retval(); | 72 return enter.retval(); |
| 76 return enter.SetResult(enter.object()->GetCameraCapabilities( | 73 return enter.SetResult( |
| 77 capabilities, | 74 enter.object()->GetCameraCapabilities(capabilities, enter.callback())); |
| 78 enter.callback())); | |
| 79 } | 75 } |
| 80 | 76 |
| 81 int32_t CaptureStillImage( | 77 int32_t CaptureStillImage( |
| 82 PP_Resource image_capture, | 78 PP_Resource image_capture, |
| 83 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | 79 PPB_ImageCapture_Private_ShutterCallback shutter_callback, |
| 84 PPB_ImageCapture_Private_PreviewCallback preview_callback, | 80 PPB_ImageCapture_Private_PreviewCallback preview_callback, |
| 85 PPB_ImageCapture_Private_JpegCallback jpeg_callback, | 81 PPB_ImageCapture_Private_JpegCallback jpeg_callback, |
| 86 int64_t* sequence_id) { | 82 int64_t* sequence_id) { |
| 87 VLOG(4) << "PPB_ImageCapture_Private::CaptureStillImage()"; | 83 VLOG(4) << "PPB_ImageCapture_Private::CaptureStillImage()"; |
| 88 EnterResource<PPB_ImageCapture_API> enter(image_capture, true); | 84 EnterResource<PPB_ImageCapture_API> enter(image_capture, true); |
| 89 if (enter.failed()) | 85 if (enter.failed()) |
| 90 return enter.retval(); | 86 return enter.retval(); |
| 91 return enter.object()->CaptureStillImage(shutter_callback, | 87 return enter.object()->CaptureStillImage(shutter_callback, preview_callback, |
| 92 preview_callback, | 88 jpeg_callback, sequence_id); |
| 93 jpeg_callback, | |
| 94 sequence_id); | |
| 95 } | 89 } |
| 96 | 90 |
| 97 const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = { | 91 const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = { |
| 98 &Create, | 92 &Create, |
| 99 &IsImageCapture, | 93 &IsImageCapture, |
| 100 &Close, | 94 &Close, |
| 101 &SetConfig, | 95 &SetConfig, |
| 102 &GetConfig, | 96 &GetConfig, |
| 103 &GetCameraCapabilities, | 97 &GetCameraCapabilities, |
| 104 &CaptureStillImage | 98 &CaptureStillImage}; |
| 105 }; | |
| 106 | 99 |
| 107 } // namespace | 100 } // namespace |
| 108 | 101 |
| 109 PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1* | 102 PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1* |
| 110 GetPPB_ImageCapture_Private_0_1_Thunk() { | 103 GetPPB_ImageCapture_Private_0_1_Thunk() { |
| 111 return &g_ppb_imagecapture_private_thunk_0_1; | 104 return &g_ppb_imagecapture_private_thunk_0_1; |
| 112 } | 105 } |
| 113 | 106 |
| 114 } // namespace thunk | 107 } // namespace thunk |
| 115 } // namespace ppapi | 108 } // namespace ppapi |
| OLD | NEW |