Android NTP: Most visited tile clicks should have PageTransition.AUTO_BOOKMARK
[chromium-blink-merge.git] / ppapi / cpp / private / camera_capabilities_private.cc
blobad3d435e51edbb1f2a0775d495fee4ab40b32d97
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 "ppapi/cpp/private/camera_capabilities_private.h"
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_size.h"
9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module_impl.h"
12 namespace pp {
14 namespace {
16 template <>
17 const char* interface_name<PPB_CameraCapabilities_Private_0_1>() {
18 return PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1;
21 } // namespace
23 CameraCapabilities_Private::CameraCapabilities_Private() {
26 CameraCapabilities_Private::CameraCapabilities_Private(
27 const CameraCapabilities_Private& other)
28 : Resource(other) {
31 CameraCapabilities_Private::CameraCapabilities_Private(const Resource& resource)
32 : Resource(resource) {
33 PP_DCHECK(IsCameraCapabilities(resource));
36 CameraCapabilities_Private::CameraCapabilities_Private(PassRef,
37 PP_Resource resource)
38 : Resource(PASS_REF, resource) {
41 CameraCapabilities_Private::~CameraCapabilities_Private() {
44 void CameraCapabilities_Private::GetSupportedVideoCaptureFormats(
45 std::vector<PP_VideoCaptureFormat>* formats) {
46 if (!has_interface<PPB_CameraCapabilities_Private_0_1>()) {
47 PP_DCHECK(false);
48 return;
51 uint32_t array_size;
52 PP_VideoCaptureFormat* array;
53 get_interface<PPB_CameraCapabilities_Private_0_1>()
54 ->GetSupportedVideoCaptureFormats(pp_resource(), &array_size, &array);
55 formats->clear();
56 formats->reserve(array_size);
57 for (uint32_t i = 0; i < array_size; i++) {
58 formats->push_back(array[i]);
62 // static
63 bool CameraCapabilities_Private::IsCameraCapabilities(
64 const Resource& resource) {
65 if (!has_interface<PPB_CameraCapabilities_Private_0_1>())
66 return false;
68 return PP_ToBool(
69 get_interface<PPB_CameraCapabilities_Private_0_1>()->IsCameraCapabilities(
70 resource.pp_resource()));
73 } // namespace pp