Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / proxy / camera_capabilities_resource.cc
blob1236aa35a66cfab01febd58a1805ac1c010d0005
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"
9 namespace ppapi {
10 namespace proxy {
12 CameraCapabilitiesResource::CameraCapabilitiesResource(
13 PP_Instance instance,
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() {
27 return this;
30 void CameraCapabilitiesResource::GetSupportedVideoCaptureFormats(
31 uint32_t* array_size,
32 PP_VideoCaptureFormat** formats) {
33 *array_size = base::checked_cast<uint32_t>(num_video_capture_formats_);
34 *formats = video_capture_formats_.get();
37 } // namespace proxy
38 } // namespace ppapi