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 modified Thu Feb 5 22:47:43 2015. | 5 // From private/ppb_image_capture_private.idl modified Fri Feb 6 14:55:55 2015. |
6 | 6 |
7 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/private/ppb_image_capture_private.h" | 9 #include "ppapi/c/private/ppb_image_capture_private.h" |
10 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
12 #include "ppapi/thunk/ppapi_thunk_export.h" | 12 #include "ppapi/thunk/ppapi_thunk_export.h" |
13 #include "ppapi/thunk/ppb_image_capture_api.h" | 13 #include "ppapi/thunk/ppb_image_capture_api.h" |
14 | 14 |
15 namespace ppapi { | 15 namespace ppapi { |
16 namespace thunk { | 16 namespace thunk { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 PP_Resource Create(PP_Instance instance, | 20 PP_Resource Create(PP_Instance instance) { |
21 struct PP_Var camera_source_id, | |
22 void* user_data) { | |
23 VLOG(4) << "PPB_ImageCapture_Private::Create()"; | 21 VLOG(4) << "PPB_ImageCapture_Private::Create()"; |
24 EnterResourceCreation enter(instance); | 22 EnterResourceCreation enter(instance); |
25 if (enter.failed()) | 23 if (enter.failed()) |
26 return 0; | 24 return 0; |
27 return enter.functions()->CreateImageCapturePrivate( | 25 return enter.functions()->CreateImageCapturePrivate(instance); |
28 instance, camera_source_id, user_data); | |
29 } | 26 } |
30 | 27 |
31 PP_Bool IsImageCapture(PP_Resource resource) { | 28 PP_Bool IsImageCapture(PP_Resource resource) { |
32 VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()"; | 29 VLOG(4) << "PPB_ImageCapture_Private::IsImageCapture()"; |
33 EnterResource<PPB_ImageCapture_API> enter(resource, false); | 30 EnterResource<PPB_ImageCapture_API> enter(resource, false); |
34 return PP_FromBool(enter.succeeded()); | 31 return PP_FromBool(enter.succeeded()); |
35 } | 32 } |
36 | 33 |
37 int32_t Close(PP_Resource resource, struct PP_CompletionCallback callback) { | 34 int32_t Open(PP_Resource image_capture, |
38 VLOG(4) << "PPB_ImageCapture_Private::Close()"; | 35 struct PP_Var device_id, |
39 EnterResource<PPB_ImageCapture_API> enter(resource, callback, true); | 36 struct PP_CompletionCallback callback) { |
| 37 VLOG(4) << "PPB_ImageCapture_Private::Open()"; |
| 38 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true); |
40 if (enter.failed()) | 39 if (enter.failed()) |
41 return enter.retval(); | 40 return enter.retval(); |
42 return enter.SetResult(enter.object()->Close(enter.callback())); | 41 return enter.SetResult(enter.object()->Open(device_id, enter.callback())); |
| 42 } |
| 43 |
| 44 void Close(PP_Resource image_capture) { |
| 45 VLOG(4) << "PPB_ImageCapture_Private::Close()"; |
| 46 EnterResource<PPB_ImageCapture_API> enter(image_capture, true); |
| 47 if (enter.failed()) |
| 48 return; |
| 49 enter.object()->Close(); |
43 } | 50 } |
44 | 51 |
45 int32_t GetCameraCapabilities(PP_Resource image_capture, | 52 int32_t GetCameraCapabilities(PP_Resource image_capture, |
46 PP_Resource* capabilities, | 53 PP_Resource* capabilities, |
47 struct PP_CompletionCallback callback) { | 54 struct PP_CompletionCallback callback) { |
48 VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()"; | 55 VLOG(4) << "PPB_ImageCapture_Private::GetCameraCapabilities()"; |
49 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true); | 56 EnterResource<PPB_ImageCapture_API> enter(image_capture, callback, true); |
50 if (enter.failed()) | 57 if (enter.failed()) |
51 return enter.retval(); | 58 return enter.retval(); |
52 return enter.SetResult( | 59 return enter.SetResult( |
53 enter.object()->GetCameraCapabilities(capabilities, enter.callback())); | 60 enter.object()->GetCameraCapabilities(capabilities, enter.callback())); |
54 } | 61 } |
55 | 62 |
56 const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = | 63 const PPB_ImageCapture_Private_0_1 g_ppb_imagecapture_private_thunk_0_1 = |
57 {&Create, &IsImageCapture, &Close, &GetCameraCapabilities}; | 64 {&Create, &IsImageCapture, &Open, &Close, &GetCameraCapabilities}; |
58 | 65 |
59 } // namespace | 66 } // namespace |
60 | 67 |
61 PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1* | 68 PPAPI_THUNK_EXPORT const PPB_ImageCapture_Private_0_1* |
62 GetPPB_ImageCapture_Private_0_1_Thunk() { | 69 GetPPB_ImageCapture_Private_0_1_Thunk() { |
63 return &g_ppb_imagecapture_private_thunk_0_1; | 70 return &g_ppb_imagecapture_private_thunk_0_1; |
64 } | 71 } |
65 | 72 |
66 } // namespace thunk | 73 } // namespace thunk |
67 } // namespace ppapi | 74 } // namespace ppapi |
OLD | NEW |