1 // Copyright 2015 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 #include "base/logging.h"
6 #include "base/numerics/safe_conversions.h"
7 #include "ppapi/proxy/camera_capabilities_resource.h"
12 CameraCapabilitiesResource::CameraCapabilitiesResource(
14 const std::vector
<PP_VideoCaptureFormat
>& formats
)
15 : Resource(OBJECT_IS_PROXY
, instance
),
16 num_video_capture_formats_(formats
.size()),
17 video_capture_formats_(
18 new PP_VideoCaptureFormat
[num_video_capture_formats_
]) {
19 std::copy(formats
.begin(), formats
.end(), video_capture_formats_
.get());
22 CameraCapabilitiesResource::~CameraCapabilitiesResource() {
25 thunk::PPB_CameraCapabilities_API
*
26 CameraCapabilitiesResource::AsPPB_CameraCapabilities_API() {
30 void CameraCapabilitiesResource::GetSupportedVideoCaptureFormats(
32 PP_VideoCaptureFormat
** formats
) {
33 *array_size
= base::checked_cast
<uint32_t>(num_video_capture_formats_
);
34 *formats
= video_capture_formats_
.get();