summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorjchuang <jchuang@chromium.org>2015-02-20 00:22:30 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 08:23:02 +0000
commitfa1f14351809dd17dba1171be48952b292ff4fa3 (patch)
treee8b8026a39fa7a118bfd3aab79542965f0a8581c /ppapi/cpp
parent8c346aae88b9d416d2941ed33b412475ad895842 (diff)
downloadchromium_src-fa1f14351809dd17dba1171be48952b292ff4fa3.zip
chromium_src-fa1f14351809dd17dba1171be48952b292ff4fa3.tar.gz
chromium_src-fa1f14351809dd17dba1171be48952b292ff4fa3.tar.bz2
PPAPI: Rename PPB_ImageCapture_Private to PPB_CameraDevice_Private
BUG=387547 TEST=Call the API from a trusted plugin. Review URL: https://codereview.chromium.org/929053003 Cr-Commit-Position: refs/heads/master@{#317271}
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/private/camera_device_private.cc87
-rw-r--r--ppapi/cpp/private/camera_device_private.h (renamed from ppapi/cpp/private/image_capture_private.h)56
-rw-r--r--ppapi/cpp/private/image_capture_private.cc87
3 files changed, 115 insertions, 115 deletions
diff --git a/ppapi/cpp/private/camera_device_private.cc b/ppapi/cpp/private/camera_device_private.cc
new file mode 100644
index 0000000..1ca39f7
--- /dev/null
+++ b/ppapi/cpp/private/camera_device_private.cc
@@ -0,0 +1,87 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/private/camera_device_private.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/instance_handle.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/private/camera_capabilities_private.h"
+
+namespace pp {
+
+namespace {
+
+template <>
+const char* interface_name<PPB_CameraDevice_Private_0_1>() {
+ return PPB_CAMERADEVICE_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+CameraDevice_Private::CameraDevice_Private() {
+}
+
+CameraDevice_Private::CameraDevice_Private(const CameraDevice_Private& other)
+ : Resource(other) {
+}
+
+CameraDevice_Private::CameraDevice_Private(const Resource& resource)
+ : Resource(resource) {
+ PP_DCHECK(IsCameraDevice(resource));
+}
+
+CameraDevice_Private::CameraDevice_Private(const InstanceHandle& instance) {
+ if (has_interface<PPB_CameraDevice_Private_0_1>()) {
+ PassRefFromConstructor(
+ get_interface<PPB_CameraDevice_Private_0_1>()->Create(
+ instance.pp_instance()));
+ return;
+ }
+ PP_DCHECK(false);
+}
+
+CameraDevice_Private::CameraDevice_Private(PassRef, PP_Resource resource)
+ : Resource(PASS_REF, resource) {
+}
+
+CameraDevice_Private::~CameraDevice_Private() {
+}
+
+int32_t CameraDevice_Private::Open(const Var& device_id,
+ const CompletionCallback& callback) {
+ if (!has_interface<PPB_CameraDevice_Private_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ return get_interface<PPB_CameraDevice_Private_0_1>()->Open(
+ pp_resource(), device_id.pp_var(), callback.pp_completion_callback());
+}
+
+void CameraDevice_Private::Close() {
+ if (has_interface<PPB_CameraDevice_Private_0_1>())
+ get_interface<PPB_CameraDevice_Private_0_1>()->Close(pp_resource());
+}
+
+int32_t CameraDevice_Private::GetCameraCapabilities(
+ const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback) {
+ if (!has_interface<PPB_CameraDevice_Private_0_1>())
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
+
+ return get_interface<PPB_CameraDevice_Private_0_1>()->GetCameraCapabilities(
+ pp_resource(), callback.output(), callback.pp_completion_callback());
+}
+
+// static
+bool CameraDevice_Private::IsCameraDevice(const Resource& resource) {
+ if (!has_interface<PPB_CameraDevice_Private_0_1>())
+ return false;
+
+ return PP_ToBool(
+ get_interface<PPB_CameraDevice_Private_0_1>()->IsCameraDevice(
+ resource.pp_resource()));
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/image_capture_private.h b/ppapi/cpp/private/camera_device_private.h
index 98382a2..dce1e1b 100644
--- a/ppapi/cpp/private/image_capture_private.h
+++ b/ppapi/cpp/private/camera_device_private.h
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
-#ifndef PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
-#define PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
+#ifndef PPAPI_CPP_PRIVATE_CAMERA_DEVICE_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_CAMERA_DEVICE_PRIVATE_H_
-#include "ppapi/c/private/ppb_image_capture_private.h"
+#include "ppapi/c/private/ppb_camera_device_private.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/var.h"
/// @file
-/// Defines the <code>ImageCapture_Private</code> interface. Used for
-/// acquiring a single still image from a camera source.
+/// Defines the <code>CameraDevice_Private</code> interface. Used for
+/// manipulating a camera device.
namespace pp {
class CameraCapabilities_Private;
@@ -23,44 +23,44 @@ template <typename T>
class CompletionCallbackWithOutput;
/// To query camera capabilities:
-/// 1. Create an ImageCapture_Private object.
+/// 1. Create a CameraDevice_Private object.
/// 2. Open() camera device with track id of MediaStream video track.
/// 3. Call GetCameraCapabilities() to get a
/// <code>CameraCapabilities_Private</code> object, which can be used to
/// query camera capabilities.
-class ImageCapture_Private : public Resource {
+class CameraDevice_Private : public Resource {
public:
/// Default constructor for creating an is_null()
- /// <code>ImageCapture_Private</code> object.
- ImageCapture_Private();
+ /// <code>CameraDevice_Private</code> object.
+ CameraDevice_Private();
- /// The copy constructor for <code>ImageCapture_Private</code>.
+ /// The copy constructor for <code>CameraDevice_Private</code>.
///
- /// @param[in] other A reference to a <code>ImageCapture_Private</code>.
- ImageCapture_Private(const ImageCapture_Private& other);
+ /// @param[in] other A reference to a <code>CameraDevice_Private</code>.
+ CameraDevice_Private(const CameraDevice_Private& other);
- /// Constructs an <code>ImageCapture_Private</code> from
- /// a <code>Resource</code>.
+ /// Constructs a <code>CameraDevice_Private</code> from a
+ /// <code>Resource</code>.
///
- /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
- explicit ImageCapture_Private(const Resource& resource);
+ /// @param[in] resource A <code>PPB_CameraDevice_Private</code> resource.
+ explicit CameraDevice_Private(const Resource& resource);
- /// Constructs an ImageCapture_Private resource.
+ /// Constructs a CameraDevice_Private resource.
///
/// @param[in] instance A <code>PP_Instance</code> identifying one instance
/// of a module.
- explicit ImageCapture_Private(const InstanceHandle& instance);
+ explicit CameraDevice_Private(const InstanceHandle& instance);
/// A constructor used when you have received a <code>PP_Resource</code> as a
/// return value that has had 1 ref added for you.
///
- /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
- ImageCapture_Private(PassRef, PP_Resource resource);
+ /// @param[in] resource A <code>PPB_CameraDevice_Private</code> resource.
+ CameraDevice_Private(PassRef, PP_Resource resource);
// Destructor.
- ~ImageCapture_Private();
+ ~CameraDevice_Private();
- /// Opens a video capture device.
+ /// Opens a camera device.
///
/// @param[in] device_id A <code>Var</code> identifying a camera
/// device. The type is string. The ID can be obtained from
@@ -71,9 +71,9 @@ class ImageCapture_Private : public Resource {
/// @return An int32_t containing a result code from <code>pp_errors.h</code>.
int32_t Open(const Var& device_id, const CompletionCallback& callback);
- /// Disconnects from the camera and cancels all pending capture requests.
+ /// Disconnects from the camera and cancels all pending requests.
/// After this returns, no callbacks will be called. If <code>
- /// ImageCapture_Private</code> is destroyed and is not closed yet, this
+ /// CameraDevice_Private</code> is destroyed and is not closed yet, this
/// function will be automatically called. Calling this more than once has no
/// effect.
void Close();
@@ -89,15 +89,15 @@ class ImageCapture_Private : public Resource {
int32_t GetCameraCapabilities(
const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback);
- /// Determines if a resource is an image capture resource.
+ /// Determines if a resource is a camera device resource.
///
/// @param[in] resource The <code>Resource</code> to test.
///
- /// @return true if the given resource is an image capture resource or false
+ /// @return true if the given resource is a camera device resource or false
/// otherwise.
- static bool IsImageCapture(const Resource& resource);
+ static bool IsCameraDevice(const Resource& resource);
};
} // namespace pp
-#endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */
+#endif /* PPAPI_CPP_PRIVATE_CAMERA_DEVICE_PRIVATE_H_ */
diff --git a/ppapi/cpp/private/image_capture_private.cc b/ppapi/cpp/private/image_capture_private.cc
deleted file mode 100644
index 539f8a3..0000000
--- a/ppapi/cpp/private/image_capture_private.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/cpp/private/image_capture_private.h"
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/instance_handle.h"
-#include "ppapi/cpp/module_impl.h"
-#include "ppapi/cpp/private/camera_capabilities_private.h"
-
-namespace pp {
-
-namespace {
-
-template <>
-const char* interface_name<PPB_ImageCapture_Private_0_1>() {
- return PPB_IMAGECAPTURE_PRIVATE_INTERFACE_0_1;
-}
-
-} // namespace
-
-ImageCapture_Private::ImageCapture_Private() {
-}
-
-ImageCapture_Private::ImageCapture_Private(const ImageCapture_Private& other)
- : Resource(other) {
-}
-
-ImageCapture_Private::ImageCapture_Private(const Resource& resource)
- : Resource(resource) {
- PP_DCHECK(IsImageCapture(resource));
-}
-
-ImageCapture_Private::ImageCapture_Private(const InstanceHandle& instance) {
- if (has_interface<PPB_ImageCapture_Private_0_1>()) {
- PassRefFromConstructor(
- get_interface<PPB_ImageCapture_Private_0_1>()->Create(
- instance.pp_instance()));
- return;
- }
- PP_DCHECK(false);
-}
-
-ImageCapture_Private::ImageCapture_Private(PassRef, PP_Resource resource)
- : Resource(PASS_REF, resource) {
-}
-
-ImageCapture_Private::~ImageCapture_Private() {
-}
-
-int32_t ImageCapture_Private::Open(const Var& device_id,
- const CompletionCallback& callback) {
- if (!has_interface<PPB_ImageCapture_Private_0_1>())
- return callback.MayForce(PP_ERROR_NOINTERFACE);
-
- return get_interface<PPB_ImageCapture_Private_0_1>()->Open(
- pp_resource(), device_id.pp_var(), callback.pp_completion_callback());
-}
-
-void ImageCapture_Private::Close() {
- if (has_interface<PPB_ImageCapture_Private_0_1>())
- get_interface<PPB_ImageCapture_Private_0_1>()->Close(pp_resource());
-}
-
-int32_t ImageCapture_Private::GetCameraCapabilities(
- const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback) {
- if (!has_interface<PPB_ImageCapture_Private_0_1>())
- return callback.MayForce(PP_ERROR_NOINTERFACE);
-
- return get_interface<PPB_ImageCapture_Private_0_1>()->GetCameraCapabilities(
- pp_resource(), callback.output(), callback.pp_completion_callback());
-}
-
-// static
-bool ImageCapture_Private::IsImageCapture(const Resource& resource) {
- if (!has_interface<PPB_ImageCapture_Private_0_1>())
- return false;
-
- return PP_ToBool(
- get_interface<PPB_ImageCapture_Private_0_1>()->IsImageCapture(
- resource.pp_resource()));
-}
-
-} // namespace pp