summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 07:59:15 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 07:59:15 +0000
commit558c1905c0a070531c4cbd592c9052a16ab61d20 (patch)
treee4840f9ca421d08cb47ac228a80b98eee1c6df1a /ppapi
parent31ce1bd018ad86c1e65cf70c487ce7971f12e3d1 (diff)
downloadchromium_src-558c1905c0a070531c4cbd592c9052a16ab61d20.zip
chromium_src-558c1905c0a070531c4cbd592c9052a16ab61d20.tar.gz
chromium_src-558c1905c0a070531c4cbd592c9052a16ab61d20.tar.bz2
Add NaCl proxies for Pepper Video Source and Destination resources.
I need to add whitelist testing to prevent arbitrary NaCl apps from using these resources. BUG=230980 TEST=browser_tests, --gtest_filter="PPAPINaClPNaClTest.Video*" Review URL: https://chromiumcodereview.appspot.com/16335018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/ppapi_proxy.gypi2
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/proxy/ppapi_messages.h49
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc22
-rw-r--r--ppapi/proxy/resource_creation_proxy.h4
-rw-r--r--ppapi/proxy/video_source_resource.cc13
-rw-r--r--ppapi/proxy/video_source_resource.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_private.h5
-rw-r--r--ppapi/thunk/interfaces_ppb_private_no_permissions.h5
-rw-r--r--ppapi/thunk/resource_creation_api.h4
10 files changed, 45 insertions, 62 deletions
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 88a2861..ba427a6 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -240,8 +240,6 @@
'proxy/serialized_flash_menu.cc',
'proxy/talk_resource.cc',
'proxy/video_capture_resource.cc',
- 'proxy/video_destination_resource.cc',
- 'proxy/video_source_resource.cc',
],
}],
],
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index cafc218..217c2a28 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -312,8 +312,6 @@
'thunk/ppb_url_util_thunk.cc',
'thunk/ppb_video_capture_thunk.cc',
'thunk/ppb_video_decoder_thunk.cc',
- 'thunk/ppb_video_destination_private_thunk.cc',
- 'thunk/ppb_video_source_private_thunk.cc',
],
}],
# We exclude a few more things for nacl_win64, to avoid pulling in
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 21e5e12..ac631b1 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1652,6 +1652,30 @@ IPC_SYNC_MESSAGE_CONTROL2_2(PpapiHostMsg_SharedMemory_CreateSharedMemory,
int /* host_handle_id */,
ppapi::proxy::SerializedHandle /* plugin_handle */)
+// MediaStream -----------------------------------------------------------------
+
+// VideoDestination Private.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoDestination_Open,
+ std::string /* stream_url */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoDestination_OpenReply)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_VideoDestination_PutFrame,
+ ppapi::HostResource /* image_data */,
+ PP_TimeTicks /* timestamp */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Close)
+
+// VideoSource Private.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoSource_Open,
+ std::string /* stream_url */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoSource_OpenReply)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_GetFrame)
+IPC_MESSAGE_CONTROL3(PpapiPluginMsg_VideoSource_GetFrameReply,
+ ppapi::HostResource /* resource_id */,
+ PP_ImageDataDesc /* image_data_desc */,
+ PP_TimeTicks /* timestamp */)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Close)
+
// WebSocket -------------------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_WebSocket_Create)
@@ -1988,29 +2012,4 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_Talk_StopRemoting)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Talk_StopRemotingReply)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Talk_NotifyEvent, PP_TalkEvent /* event */)
-// MediaStream -----------------------------------------------------------------
-
-// VideoDestination Private.
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Create)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoDestination_Open,
- std::string /* stream_url */)
-IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoDestination_OpenReply)
-IPC_MESSAGE_CONTROL2(PpapiHostMsg_VideoDestination_PutFrame,
- ppapi::HostResource /* image_data */,
- PP_TimeTicks /* timestamp */)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDestination_Close)
-
-// VideoSource Private.
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Create)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_VideoSource_Open,
- std::string /* stream_url */)
-IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoSource_OpenReply)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_GetFrame)
-IPC_MESSAGE_CONTROL4(PpapiPluginMsg_VideoSource_GetFrameReply,
- ppapi::HostResource /* resource_id */,
- PP_ImageDataDesc /* image_data_desc */,
- int /* fd */,
- PP_TimeTicks /* timestamp */)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoSource_Close)
-
#endif // !defined(OS_NACL) && !defined(NACL_WIN64)
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index d91f30d..90535fe 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -329,6 +329,17 @@ PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate(
GetConnection(), instance))->GetReference();
}
+PP_Resource ResourceCreationProxy::CreateVideoDestination(
+ PP_Instance instance) {
+ return (new VideoDestinationResource(GetConnection(),
+ instance))->GetReference();
+}
+
+PP_Resource ResourceCreationProxy::CreateVideoSource(
+ PP_Instance instance) {
+ return (new VideoSourceResource(GetConnection(), instance))->GetReference();
+}
+
PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) {
return (new WebSocketResource(GetConnection(), instance))->GetReference();
}
@@ -418,17 +429,6 @@ PP_Resource ResourceCreationProxy::CreateVideoDecoder(
instance, context3d_id, profile);
}
-PP_Resource ResourceCreationProxy::CreateVideoDestination(
- PP_Instance instance) {
- return (new VideoDestinationResource(GetConnection(),
- instance))->GetReference();
-}
-
-PP_Resource ResourceCreationProxy::CreateVideoSource(
- PP_Instance instance) {
- return (new VideoSourceResource(GetConnection(), instance))->GetReference();
-}
-
#endif // !defined(OS_NACL)
bool ResourceCreationProxy::Send(IPC::Message* msg) {
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 0ac2468..97ba608 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -143,6 +143,8 @@ class ResourceCreationProxy : public InterfaceProxy,
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateUDPSocket(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instance) OVERRIDE;
+ virtual PP_Resource CreateVideoDestination(PP_Instance instance) OVERRIDE;
+ virtual PP_Resource CreateVideoSource(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateWebSocket(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateX509CertificatePrivate(
PP_Instance instance) OVERRIDE;
@@ -170,8 +172,6 @@ class ResourceCreationProxy : public InterfaceProxy,
PP_Instance instance,
PP_Resource context3d_id,
PP_VideoDecoder_Profile profile) OVERRIDE;
- virtual PP_Resource CreateVideoDestination(PP_Instance instance) OVERRIDE;
- virtual PP_Resource CreateVideoSource(PP_Instance instance) OVERRIDE;
#endif // !defined(OS_NACL)
virtual bool Send(IPC::Message* msg) OVERRIDE;
diff --git a/ppapi/proxy/video_source_resource.cc b/ppapi/proxy/video_source_resource.cc
index f6c5fdc..c294903 100644
--- a/ppapi/proxy/video_source_resource.cc
+++ b/ppapi/proxy/video_source_resource.cc
@@ -66,7 +66,6 @@ int32_t VideoSourceResource::GetFrame(
return PP_ERROR_INPROGRESS;
get_frame_callback_ = callback;
-
Call<PpapiPluginMsg_VideoSource_GetFrameReply>(RENDERER,
PpapiHostMsg_VideoSource_GetFrame(),
base::Bind(&VideoSourceResource::OnPluginMsgGetFrameComplete, this,
@@ -98,7 +97,6 @@ void VideoSourceResource::OnPluginMsgGetFrameComplete(
const ResourceMessageReplyParams& reply_params,
const HostResource& image_data,
const PP_ImageDataDesc& image_desc,
- int fd,
PP_TimeTicks timestamp) {
// The callback may have been aborted by Close().
if (TrackedCallback::IsPending(get_frame_callback_)) {
@@ -107,21 +105,12 @@ void VideoSourceResource::OnPluginMsgGetFrameComplete(
PPB_ImageData_Shared::IsImageDataDescValid(image_desc)) {
frame->timestamp = timestamp;
-#if defined(OS_ANDROID)
- frame->image_data = 0;
-#elif defined(TOOLKIT_GTK)
- frame->image_data =
- (new PlatformImageData(image_data, image_desc, fd))->GetReference();
-#elif defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX)
base::SharedMemoryHandle handle;
if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &handle))
frame->image_data = 0;
frame->image_data =
- (new PlatformImageData(
+ (new SimpleImageData(
image_data, image_desc, handle))->GetReference();
-#else
-#error Not implemented.
-#endif
}
get_frame_callback_->Run(result);
}
diff --git a/ppapi/proxy/video_source_resource.h b/ppapi/proxy/video_source_resource.h
index 23d7240..cdd4638 100644
--- a/ppapi/proxy/video_source_resource.h
+++ b/ppapi/proxy/video_source_resource.h
@@ -52,7 +52,6 @@ class PPAPI_PROXY_EXPORT VideoSourceResource
const ResourceMessageReplyParams& reply_params,
const HostResource& image_data,
const PP_ImageDataDesc& image_desc_data,
- int fd,
PP_TimeTicks timestamp);
scoped_refptr<TrackedCallback> open_callback_;
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index fcba53c..52fcb77 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -52,11 +52,6 @@ PROXIED_IFACE(NoAPIName, PPB_FILEIOTRUSTED_INTERFACE_0_4, PPB_FileIOTrusted_0_4)
PROXIED_IFACE(NoAPIName, PPB_URLLOADERTRUSTED_INTERFACE_0_3,
PPB_URLLoaderTrusted_0_3)
-PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1,
- PPB_VideoDestination_Private_0_1)
-PROXIED_IFACE(NoAPIName, PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1,
- PPB_VideoSource_Private_0_1)
-
// Hack to keep font working. The Font 0.6 API is binary compatible with
// BrowserFont 1.0, so just map the string to the same thing.
// TODO(brettw) remove support for the old Font API.
diff --git a/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
index dca6289..a76665a 100644
--- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h
+++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -52,4 +52,9 @@ PROXIED_IFACE(NoAPIName, PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1,
PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1,
PPB_FileIO_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1,
+ PPB_VideoDestination_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1,
+ PPB_VideoSource_Private_0_1)
+
#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 2d0fd90..4a2c30d 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -156,6 +156,8 @@ class ResourceCreationAPI {
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0;
virtual PP_Resource CreateUDPSocket(PP_Instance instace) = 0;
virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instace) = 0;
+ virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0;
+ virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0;
virtual PP_Resource CreateWebSocket(PP_Instance instance) = 0;
virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0;
#if !defined(OS_NACL)
@@ -181,8 +183,6 @@ class ResourceCreationAPI {
PP_Instance instance,
PP_Resource context3d_id,
PP_VideoDecoder_Profile profile) = 0;
- virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0;
- virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0;
#endif // !defined(OS_NACL)
static const ApiID kApiID = API_ID_RESOURCE_CREATION;