Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ppapi/cpp/private/camera_capabilities_private.h" | |
| 6 | |
| 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" | |
| 11 | |
| 12 namespace pp { | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 template <> | |
| 17 const char* interface_name<PPB_CameraCapabilities_Private_0_1>() { | |
| 18 return PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1; | |
| 19 } | |
| 20 | |
| 21 } // namespace | |
| 22 | |
| 23 CameraCapabilities_Private::CameraCapabilities_Private() { | |
| 24 } | |
| 25 | |
| 26 CameraCapabilities_Private::CameraCapabilities_Private( | |
| 27 const CameraCapabilities_Private& other) | |
| 28 : Resource(other) { | |
| 29 } | |
| 30 | |
| 31 CameraCapabilities_Private::CameraCapabilities_Private(const Resource& resource) | |
| 32 : Resource(resource) { | |
| 33 PP_DCHECK(IsCameraCapabilities(resource)); | |
| 34 } | |
| 35 | |
| 36 CameraCapabilities_Private::CameraCapabilities_Private(PassRef, | |
| 37 PP_Resource resource) | |
| 38 : Resource(PASS_REF, resource) { | |
| 39 } | |
| 40 | |
| 41 CameraCapabilities_Private::~CameraCapabilities_Private() { | |
| 42 } | |
| 43 | |
| 44 void CameraCapabilities_Private::GetSupportedPreviewSizes( | |
| 45 std::vector<Size>* preview_sizes) { | |
| 46 if (!has_interface<PPB_CameraCapabilities_Private_0_1>()) { | |
| 47 PP_DCHECK(false); | |
| 48 return; | |
| 49 } | |
| 50 | |
| 51 int32_t array_size; | |
| 52 PP_Size* array; | |
| 53 get_interface<PPB_CameraCapabilities_Private_0_1>()->GetSupportedPreviewSizes( | |
| 54 pp_resource(), &array_size, &array); | |
| 55 preview_sizes->clear(); | |
|
dmichael (off chromium)
2015/02/03 19:21:29
might as well:
preview_sizes->reserve(array_size);
Justin Chuang
2015/02/04 17:44:24
Done. Thanks.
| |
| 56 for (int32_t i = 0; i < array_size; i++) { | |
| 57 preview_sizes->push_back(Size(array[i])); | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 // static | |
| 62 bool CameraCapabilities_Private::IsCameraCapabilities( | |
| 63 const Resource& resource) { | |
| 64 if (!has_interface<PPB_CameraCapabilities_Private_0_1>()) | |
| 65 return false; | |
| 66 | |
| 67 return PP_ToBool( | |
| 68 get_interface<PPB_CameraCapabilities_Private_0_1>()->IsCameraCapabilities( | |
| 69 resource.pp_resource())); | |
| 70 } | |
| 71 | |
| 72 } // namespace pp | |
| OLD | NEW |