summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-21 07:54:17 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-21 07:54:17 +0000
commitdca65e16a1b85db7b2dfcd2f37bf656db553f306 (patch)
treee68f923eb74110b3194d0280ee4481958b55d91e /ppapi
parent2c9a3dca8ee47ad67ee6d8c12dc12f3c3356ca7c (diff)
downloadchromium_src-dca65e16a1b85db7b2dfcd2f37bf656db553f306.zip
chromium_src-dca65e16a1b85db7b2dfcd2f37bf656db553f306.tar.gz
chromium_src-dca65e16a1b85db7b2dfcd2f37bf656db553f306.tar.bz2
Implement PPB_DeviceRef_Dev.
This is part of the work to suppport enumeration of multiple audio/video capture devices. Relevant changes: The thread that discussed interface design - http://codereview.chromium.org/8981009/ PPB_ResourceArray_Dev (committed) - http://codereview.chromium.org/9111008/ BUG=None TEST=None Review URL: http://codereview.chromium.org/9192019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/dev/ppb_device_ref_dev.idl56
-rw-r--r--ppapi/c/dev/ppb_device_ref_dev.h86
-rw-r--r--ppapi/cpp/dev/device_ref_dev.cc48
-rw-r--r--ppapi/cpp/dev/device_ref_dev.h35
-rw-r--r--ppapi/ppapi_shared.gypi4
-rw-r--r--ppapi/ppapi_sources.gypi3
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h8
-rw-r--r--ppapi/shared_impl/ppb_device_ref_shared.cc48
-rw-r--r--ppapi/shared_impl/ppb_device_ref_shared.h60
-rw-r--r--ppapi/shared_impl/resource.h1
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/tests/all_cpp_includes.h4
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h1
-rw-r--r--ppapi/thunk/ppb_device_ref_api.h32
-rw-r--r--ppapi/thunk/ppb_device_ref_thunk.cc46
16 files changed, 433 insertions, 1 deletions
diff --git a/ppapi/api/dev/ppb_device_ref_dev.idl b/ppapi/api/dev/ppb_device_ref_dev.idl
new file mode 100644
index 0000000..51d468b
--- /dev/null
+++ b/ppapi/api/dev/ppb_device_ref_dev.idl
@@ -0,0 +1,56 @@
+/* Copyright (c) 2012 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.
+ */
+
+/**
+ * This file defines the <code>PPB_DeviceRef_Dev</code> interface.
+ */
+label Chrome {
+ M18 = 0.1
+};
+
+/**
+ * Device types.
+ */
+[assert_size(4)]
+enum PP_DeviceType_Dev {
+ PP_DEVICETYPE_DEV_INVALID = 0,
+ PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1,
+ PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2
+};
+
+interface PPB_DeviceRef_Dev {
+ /**
+ * Determines if the provided resource is a device reference.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
+ * resource.
+ *
+ * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
+ * resource is a device reference, otherwise <code>PP_FALSE</code>.
+ */
+ PP_Bool IsDeviceRef([in] PP_Resource resource);
+
+ /**
+ * Gets the device type.
+ *
+ * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
+ * reference.
+ *
+ * @return A <code>PP_DeviceType_Dev</code> value.
+ */
+ PP_DeviceType_Dev GetType([in] PP_Resource device_ref);
+
+ /**
+ * Gets the device name.
+ *
+ * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
+ * reference.
+ *
+ * @return A <code>PP_Var</code> of type <code>PP_VARTYPE_STRING</code>
+ * containing the name of the device if successful; a <code>PP_Var</code> of
+ * type <code>PP_VARTYPE_UNDEFINED</code> if failed.
+ */
+ PP_Var GetName([in] PP_Resource device_ref);
+};
diff --git a/ppapi/c/dev/ppb_device_ref_dev.h b/ppapi/c/dev/ppb_device_ref_dev.h
new file mode 100644
index 0000000..7381880
--- /dev/null
+++ b/ppapi/c/dev/ppb_device_ref_dev.h
@@ -0,0 +1,86 @@
+/* Copyright (c) 2012 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.
+ */
+
+/* From dev/ppb_device_ref_dev.idl modified Fri Jan 20 12:58:06 2012. */
+
+#ifndef PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
+#define PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_DEVICEREF_DEV_INTERFACE_0_1 "PPB_DeviceRef(Dev);0.1"
+#define PPB_DEVICEREF_DEV_INTERFACE PPB_DEVICEREF_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_DeviceRef_Dev</code> interface.
+ */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * Device types.
+ */
+typedef enum {
+ PP_DEVICETYPE_DEV_INVALID = 0,
+ PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1,
+ PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2
+} PP_DeviceType_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DeviceType_Dev, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_DeviceRef_Dev_0_1 {
+ /**
+ * Determines if the provided resource is a device reference.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
+ * resource.
+ *
+ * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
+ * resource is a device reference, otherwise <code>PP_FALSE</code>.
+ */
+ PP_Bool (*IsDeviceRef)(PP_Resource resource);
+ /**
+ * Gets the device type.
+ *
+ * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
+ * reference.
+ *
+ * @return A <code>PP_DeviceType_Dev</code> value.
+ */
+ PP_DeviceType_Dev (*GetType)(PP_Resource device_ref);
+ /**
+ * Gets the device name.
+ *
+ * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
+ * reference.
+ *
+ * @return A <code>PP_Var</code> of type <code>PP_VARTYPE_STRING</code>
+ * containing the name of the device if successful; a <code>PP_Var</code> of
+ * type <code>PP_VARTYPE_UNDEFINED</code> if failed.
+ */
+ struct PP_Var (*GetName)(PP_Resource device_ref);
+};
+
+typedef struct PPB_DeviceRef_Dev_0_1 PPB_DeviceRef_Dev;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_DEVICE_REF_DEV_H_ */
+
diff --git a/ppapi/cpp/dev/device_ref_dev.cc b/ppapi/cpp/dev/device_ref_dev.cc
new file mode 100644
index 0000000..4fc2bc5
--- /dev/null
+++ b/ppapi/cpp/dev/device_ref_dev.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 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/dev/device_ref_dev.h"
+
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_DeviceRef_Dev>() {
+ return PPB_DEVICEREF_DEV_INTERFACE;
+}
+
+} // namespace
+
+DeviceRef_Dev::DeviceRef_Dev() {
+}
+
+DeviceRef_Dev::DeviceRef_Dev(PP_Resource resource) : Resource(resource) {
+}
+
+DeviceRef_Dev::DeviceRef_Dev(PassRef, PP_Resource resource) {
+ PassRefFromConstructor(resource);
+}
+
+DeviceRef_Dev::DeviceRef_Dev(const DeviceRef_Dev& other) : Resource(other) {
+}
+
+DeviceRef_Dev::~DeviceRef_Dev() {
+}
+
+PP_DeviceType_Dev DeviceRef_Dev::GetType() const {
+ if (!has_interface<PPB_DeviceRef_Dev>())
+ return PP_DEVICETYPE_DEV_INVALID;
+ return get_interface<PPB_DeviceRef_Dev>()->GetType(pp_resource());
+}
+
+Var DeviceRef_Dev::GetName() const {
+ if (!has_interface<PPB_DeviceRef_Dev>())
+ return Var();
+ return Var(Var::PassRef(),
+ get_interface<PPB_DeviceRef_Dev>()->GetName(pp_resource()));
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/dev/device_ref_dev.h b/ppapi/cpp/dev/device_ref_dev.h
new file mode 100644
index 0000000..515c388
--- /dev/null
+++ b/ppapi/cpp/dev/device_ref_dev.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 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.
+
+#ifndef PPAPI_CPP_DEV_DEVICE_REF_DEV_H_
+#define PPAPI_CPP_DEV_DEVICE_REF_DEV_H_
+
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/cpp/resource.h"
+#include "ppapi/cpp/var.h"
+
+namespace pp {
+
+class DeviceRef_Dev : public Resource {
+ public:
+ DeviceRef_Dev();
+
+ explicit DeviceRef_Dev(PP_Resource resource);
+
+ struct PassRef {};
+
+ DeviceRef_Dev(PassRef, PP_Resource resource);
+
+ DeviceRef_Dev(const DeviceRef_Dev& other);
+
+ virtual ~DeviceRef_Dev();
+
+ PP_DeviceType_Dev GetType() const;
+
+ Var GetName() const;
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_DEV_DEVICE_REF_DEV_H_
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index a12a097..5aff613 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -75,6 +75,8 @@
'shared_impl/ppb_char_set_shared.cc',
'shared_impl/ppb_char_set_shared.h',
'shared_impl/ppb_crypto_shared.cc',
+ 'shared_impl/ppb_device_ref_shared.cc',
+ 'shared_impl/ppb_device_ref_shared.h',
'shared_impl/ppb_file_io_shared.cc',
'shared_impl/ppb_file_io_shared.h',
'shared_impl/ppb_file_ref_shared.cc',
@@ -156,6 +158,8 @@
'thunk/ppb_console_thunk.cc',
'thunk/ppb_cursor_control_api.h',
'thunk/ppb_cursor_control_thunk.cc',
+ 'thunk/ppb_device_ref_api.h',
+ 'thunk/ppb_device_ref_thunk.cc',
'thunk/ppb_directory_reader_api.h',
'thunk/ppb_directory_reader_thunk.cc',
'thunk/ppb_input_event_api.h',
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index f0ba28f..4336ff6 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -56,6 +56,7 @@
'c/dev/ppb_char_set_dev.h',
'c/dev/ppb_console_dev.h',
'c/dev/ppb_cursor_control_dev.h',
+ 'c/dev/ppb_device_ref_dev.h',
'c/dev/ppb_directory_reader_dev.h',
'c/dev/ppb_file_chooser_dev.h',
'c/dev/ppb_find_dev.h',
@@ -176,6 +177,8 @@
'cpp/dev/audio_input_dev.h',
'cpp/dev/buffer_dev.cc',
'cpp/dev/buffer_dev.h',
+ 'cpp/dev/device_ref_dev.cc',
+ 'cpp/dev/device_ref_dev.h',
'cpp/dev/directory_entry_dev.cc',
'cpp/dev/directory_entry_dev.h',
'cpp/dev/directory_reader_dev.cc',
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 2ab2df6..f5c4d31 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -11,6 +11,7 @@
#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 085be37..ef5ee81 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -35,6 +35,7 @@
#include "ppapi/proxy/serialized_flash_menu.h"
#include "ppapi/proxy/serialized_structs.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
+#include "ppapi/shared_impl/ppb_device_ref_shared.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "ppapi/shared_impl/ppb_url_request_info_shared.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
@@ -44,6 +45,7 @@
#define IPC_MESSAGE_START PpapiMsgStart
+IPC_ENUM_TRAITS(PP_DeviceType_Dev)
IPC_ENUM_TRAITS(PP_InputEvent_Type)
IPC_ENUM_TRAITS(PP_InputEvent_MouseButton)
IPC_ENUM_TRAITS(PP_TextInput_Type)
@@ -87,6 +89,12 @@ IPC_STRUCT_TRAITS_BEGIN(PP_VideoCaptureDeviceInfo_Dev)
IPC_STRUCT_TRAITS_MEMBER(frames_per_second)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData)
+ IPC_STRUCT_TRAITS_MEMBER(type)
+ IPC_STRUCT_TRAITS_MEMBER(name)
+ IPC_STRUCT_TRAITS_MEMBER(id)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPVideoCapture_Buffer)
IPC_STRUCT_TRAITS_MEMBER(resource)
IPC_STRUCT_TRAITS_MEMBER(handle)
diff --git a/ppapi/shared_impl/ppb_device_ref_shared.cc b/ppapi/shared_impl/ppb_device_ref_shared.cc
new file mode 100644
index 0000000..edd01f2
--- /dev/null
+++ b/ppapi/shared_impl/ppb_device_ref_shared.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 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/shared_impl/ppb_device_ref_shared.h"
+
+#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/var.h"
+
+using ppapi::thunk::PPB_DeviceRef_API;
+
+namespace ppapi {
+
+DeviceRefData::DeviceRefData()
+ : type(PP_DEVICETYPE_DEV_INVALID) {
+}
+
+PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsImpl&,
+ PP_Instance instance,
+ const DeviceRefData& data)
+ : Resource(instance),
+ data_(data) {
+}
+
+PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsProxy&,
+ PP_Instance instance,
+ const DeviceRefData& data)
+ : Resource(HostResource::MakeInstanceOnly(instance)),
+ data_(data) {
+}
+
+PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() {
+ return this;
+}
+
+const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const {
+ return data_;
+}
+
+PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() {
+ return data_.type;
+}
+
+PP_Var PPB_DeviceRef_Shared::GetName() {
+ return StringVar::StringToPPVar(data_.name);
+}
+
+} // namespace ppapi
diff --git a/ppapi/shared_impl/ppb_device_ref_shared.h b/ppapi/shared_impl/ppb_device_ref_shared.h
new file mode 100644
index 0000000..bbdda72
--- /dev/null
+++ b/ppapi/shared_impl/ppb_device_ref_shared.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 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.
+
+#ifndef PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
+#define PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/thunk/ppb_device_ref_api.h"
+
+namespace ppapi {
+
+// IF YOU ADD STUFF TO THIS CLASS
+// ==============================
+// Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h.
+struct PPAPI_SHARED_EXPORT DeviceRefData {
+ DeviceRefData();
+
+ PP_DeviceType_Dev type;
+ std::string name;
+ std::string id;
+};
+
+class PPAPI_SHARED_EXPORT PPB_DeviceRef_Shared
+ : public Resource,
+ public thunk::PPB_DeviceRef_API {
+ public:
+ struct InitAsImpl {};
+ struct InitAsProxy {};
+
+ // The dummy arguments control which version of Resource's constructor is
+ // called for this base class.
+ PPB_DeviceRef_Shared(const InitAsImpl&,
+ PP_Instance instance,
+ const DeviceRefData& data);
+ PPB_DeviceRef_Shared(const InitAsProxy&,
+ PP_Instance instance,
+ const DeviceRefData& data);
+
+ // Resource overrides.
+ virtual PPB_DeviceRef_API* AsPPB_DeviceRef_API() OVERRIDE;
+
+ // PPB_DeviceRef_API implementation.
+ virtual const DeviceRefData& GetDeviceRefData() const OVERRIDE;
+ virtual PP_DeviceType_Dev GetType() OVERRIDE;
+ virtual PP_Var GetName() OVERRIDE;
+
+ private:
+ DeviceRefData data_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_DeviceRef_Shared);
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 15571fa..c0efdb8 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -24,6 +24,7 @@
F(PPB_Broker_API) \
F(PPB_Buffer_API) \
F(PPB_BufferTrusted_API) \
+ F(PPB_DeviceRef_API) \
F(PPB_DirectoryReader_API) \
F(PPB_FileChooser_API) \
F(PPB_FileIO_API) \
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 6189968..01dd072 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -16,6 +16,7 @@
#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_find_dev.h"
diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h
index 8ba62a1..5bd6d50 100644
--- a/ppapi/tests/all_cpp_includes.h
+++ b/ppapi/tests/all_cpp_includes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
//
@@ -13,6 +13,7 @@
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/core.h"
#include "ppapi/cpp/dev/buffer_dev.h"
+#include "ppapi/cpp/dev/device_ref_dev.h"
#include "ppapi/cpp/dev/directory_entry_dev.h"
#include "ppapi/cpp/dev/directory_reader_dev.h"
#include "ppapi/cpp/dev/file_chooser_dev.h"
@@ -22,6 +23,7 @@
#include "ppapi/cpp/dev/ime_input_event_dev.h"
#include "ppapi/cpp/dev/memory_dev.h"
#include "ppapi/cpp/dev/printing_dev.h"
+#include "ppapi/cpp/dev/resource_array_dev.h"
#include "ppapi/cpp/dev/scriptable_object_deprecated.h"
#include "ppapi/cpp/dev/scrollbar_dev.h"
#include "ppapi/cpp/dev/selection_dev.h"
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index e405a60..e4bc1b8 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -35,6 +35,7 @@ PROXIED_IFACE(PPB_Graphics3D,
PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
PROXIED_IFACE(PPB_CursorControl, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
PPB_CursorControl_Dev_0_4)
+PROXIED_IFACE(NoAPIName, PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1)
UNPROXIED_IFACE(PPB_DirectoryReader, PPB_DIRECTORYREADER_DEV_INTERFACE_0_5,
PPB_DirectoryReader_Dev_0_5)
UNPROXIED_IFACE(PPB_Find, PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3)
diff --git a/ppapi/thunk/ppb_device_ref_api.h b/ppapi/thunk/ppb_device_ref_api.h
new file mode 100644
index 0000000..19812e7
--- /dev/null
+++ b/ppapi/thunk/ppb_device_ref_api.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 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.
+
+#ifndef PPAPI_THUNK_PPB_DEVICE_REF_API_H_
+#define PPAPI_THUNK_PPB_DEVICE_REF_API_H_
+
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct DeviceRefData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_DeviceRef_API {
+ public:
+ virtual ~PPB_DeviceRef_API() {}
+
+ // This function is not exposed through the C API, but returns the internal
+ // data for easy proxying.
+ virtual const DeviceRefData& GetDeviceRefData() const = 0;
+
+ virtual PP_DeviceType_Dev GetType() = 0;
+ virtual PP_Var GetName() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_DEVICE_REF_API_H_
diff --git a/ppapi/thunk/ppb_device_ref_thunk.cc b/ppapi/thunk/ppb_device_ref_thunk.cc
new file mode 100644
index 0000000..7424ca4
--- /dev/null
+++ b/ppapi/thunk/ppb_device_ref_thunk.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 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/thunk/enter.h"
+#include "ppapi/thunk/ppb_device_ref_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsDeviceRef(PP_Resource resource) {
+ EnterResource<PPB_DeviceRef_API> enter(resource, false);
+ return enter.succeeded() ? PP_TRUE : PP_FALSE;
+}
+
+PP_DeviceType_Dev GetType(PP_Resource device_ref) {
+ EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
+ if (enter.failed())
+ return PP_DEVICETYPE_DEV_INVALID;
+ return enter.object()->GetType();
+}
+
+PP_Var GetName(PP_Resource device_ref) {
+ EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetName();
+}
+
+const PPB_DeviceRef_Dev g_ppb_device_ref_thunk = {
+ &IsDeviceRef,
+ &GetType,
+ &GetName
+};
+
+} // namespace
+
+const PPB_DeviceRef_Dev_0_1* GetPPB_DeviceRef_Dev_0_1_Thunk() {
+ return &g_ppb_device_ref_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi