| 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 #include "ppapi/cpp/private/image_capture_private.h" | 5 #include "ppapi/cpp/private/image_capture_private.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
| 10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| 11 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 12 #include "ppapi/cpp/private/camera_capabilities_private.h" | 12 #include "ppapi/cpp/private/camera_capabilities_private.h" |
| 13 #include "ppapi/cpp/private/image_capture_config_private.h" | |
| 14 | 13 |
| 15 namespace pp { | 14 namespace pp { |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 template <> | 18 template <> |
| 20 const char* interface_name<PPB_ImageCapture_Private_0_1>() { | 19 const char* interface_name<PPB_ImageCapture_Private_0_1>() { |
| 21 return PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1; | 20 return PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1; |
| 22 } | 21 } |
| 23 | 22 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 camera_source_id.pp_var(), | 61 camera_source_id.pp_var(), |
| 63 callback.pp_completion_callback()); | 62 callback.pp_completion_callback()); |
| 64 } | 63 } |
| 65 | 64 |
| 66 void ImageCapture_Private::Close() { | 65 void ImageCapture_Private::Close() { |
| 67 if (has_interface<PPB_ImageCapture_Private_0_1>()) { | 66 if (has_interface<PPB_ImageCapture_Private_0_1>()) { |
| 68 get_interface<PPB_ImageCapture_Private_0_1>()->Close(pp_resource()); | 67 get_interface<PPB_ImageCapture_Private_0_1>()->Close(pp_resource()); |
| 69 } | 68 } |
| 70 } | 69 } |
| 71 | 70 |
| 72 int32_t ImageCapture_Private::SetConfig( | |
| 73 const ImageCaptureConfig_Private& config, | |
| 74 const CompletionCallback& callback) { | |
| 75 if (!has_interface<PPB_ImageCapture_Private_0_1>()) | |
| 76 return PP_ERROR_NOINTERFACE; | |
| 77 | |
| 78 return get_interface<PPB_ImageCapture_Private_0_1>()->SetConfig( | |
| 79 pp_resource(), config.pp_resource(), callback.pp_completion_callback()); | |
| 80 } | |
| 81 | |
| 82 int32_t ImageCapture_Private::GetConfig( | |
| 83 const CompletionCallbackWithOutput<ImageCaptureConfig_Private>& callback) { | |
| 84 if (!has_interface<PPB_ImageCapture_Private_0_1>()) | |
| 85 return PP_ERROR_NOINTERFACE; | |
| 86 | |
| 87 return get_interface<PPB_ImageCapture_Private_0_1>()->GetConfig( | |
| 88 pp_resource(), callback.output(), callback.pp_completion_callback()); | |
| 89 } | |
| 90 | |
| 91 int32_t ImageCapture_Private::GetCameraCapabilities( | 71 int32_t ImageCapture_Private::GetCameraCapabilities( |
| 92 const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback) { | 72 const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback) { |
| 93 if (!has_interface<PPB_ImageCapture_Private_0_1>()) | 73 if (!has_interface<PPB_ImageCapture_Private_0_1>()) |
| 94 return PP_ERROR_NOINTERFACE; | 74 return PP_ERROR_NOINTERFACE; |
| 95 | 75 |
| 96 return get_interface<PPB_ImageCapture_Private_0_1>()->GetCameraCapabilities( | 76 return get_interface<PPB_ImageCapture_Private_0_1>()->GetCameraCapabilities( |
| 97 pp_resource(), callback.output(), callback.pp_completion_callback()); | 77 pp_resource(), callback.output(), callback.pp_completion_callback()); |
| 98 } | 78 } |
| 99 | 79 |
| 100 int32_t ImageCapture_Private::CaptureStillImage( | |
| 101 PPB_ImageCapture_Private_ShutterCallback shutter_callback, | |
| 102 PPB_ImageCapture_Private_PreviewCallback preview_callback, | |
| 103 PPB_ImageCapture_Private_JpegCallback jpeg_callback, | |
| 104 int64_t* sequence_id) { | |
| 105 if (!has_interface<PPB_ImageCapture_Private_0_1>()) | |
| 106 return PP_ERROR_NOINTERFACE; | |
| 107 | |
| 108 return get_interface<PPB_ImageCapture_Private_0_1>()->CaptureStillImage( | |
| 109 pp_resource(), | |
| 110 shutter_callback, | |
| 111 preview_callback, | |
| 112 jpeg_callback, | |
| 113 sequence_id); | |
| 114 } | |
| 115 | |
| 116 // static | 80 // static |
| 117 bool ImageCapture_Private::IsImageCapture(const Resource& resource) { | 81 bool ImageCapture_Private::IsImageCapture(const Resource& resource) { |
| 118 if (!has_interface<PPB_ImageCapture_Private_0_1>()) | 82 if (!has_interface<PPB_ImageCapture_Private_0_1>()) |
| 119 return false; | 83 return false; |
| 120 | 84 |
| 121 return PP_ToBool( | 85 return PP_ToBool( |
| 122 get_interface<PPB_ImageCapture_Private_0_1>()->IsImageCapture( | 86 get_interface<PPB_ImageCapture_Private_0_1>()->IsImageCapture( |
| 123 resource.pp_resource())); | 87 resource.pp_resource())); |
| 124 } | 88 } |
| 125 | 89 |
| 126 } // namespace pp | 90 } // namespace pp |
| OLD | NEW |