summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 23:03:16 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 23:03:16 +0000
commit95cc0fedf1730672686d6eafd938274ccf2b48ee (patch)
tree640815a2399c2277b2aa7e186fc885ccec92a9de /ppapi
parent40b9aa6ac971264a5162260696bf28d08f1fdcb1 (diff)
downloadchromium_src-95cc0fedf1730672686d6eafd938274ccf2b48ee.zip
chromium_src-95cc0fedf1730672686d6eafd938274ccf2b48ee.tar.gz
chromium_src-95cc0fedf1730672686d6eafd938274ccf2b48ee.tar.bz2
Add a private PPB_Talk_Private interface.
It exposes one function that sends a message to the browser and issues a reply. The browser doesn't implement this yet. BUG=117564 TEST= Review URL: https://chromiumcodereview.appspot.com/9700028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_talk_private.idl35
-rw-r--r--ppapi/c/private/ppb_talk_private.h58
-rw-r--r--ppapi/ppapi_proxy.gypi2
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/proxy/interface_list.cc2
-rw-r--r--ppapi/proxy/ppapi_messages.h13
-rw-r--r--ppapi/proxy/ppb_talk_private_proxy.cc92
-rw-r--r--ppapi/proxy/ppb_talk_private_proxy.h38
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc5
-rw-r--r--ppapi/proxy/resource_creation_proxy.h1
-rw-r--r--ppapi/shared_impl/api_id.h1
-rw-r--r--ppapi/shared_impl/resource.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_private.h3
-rw-r--r--ppapi/thunk/ppb_talk_private_api.h23
-rw-r--r--ppapi/thunk/ppb_talk_private_thunk.cc43
-rw-r--r--ppapi/thunk/resource_creation_api.h1
16 files changed, 320 insertions, 0 deletions
diff --git a/ppapi/api/private/ppb_talk_private.idl b/ppapi/api/private/ppb_talk_private.idl
new file mode 100644
index 0000000..65265ae
--- /dev/null
+++ b/ppapi/api/private/ppb_talk_private.idl
@@ -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.
+ */
+
+/**
+ * This file contains the <code>PPB_Talk</code> interface.
+ */
+label Chrome {
+ M19 = 1.0
+};
+
+/**
+ * Extra interface for Talk.
+ */
+interface PPB_Talk_Private {
+ /**
+ * Creates a Talk_Private resource.
+ */
+ PP_Resource Create(PP_Instance instance);
+
+ /**
+ * Displays security UI.
+ *
+ * The callback will be issued with PP_OK as the result of the user gave
+ * permission, or PP_ERROR_NOACCESS if the user denied.
+ *
+ * You can only have one call pending. It will return PP_OK_COMPLETIONPENDING
+ * if the request is queued, or PP_ERROR_INPROGRESS if there is already a
+ * request in progress.
+ */
+ int32_t GetPermission(
+ [in] PP_Resource talk_resource,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/c/private/ppb_talk_private.h b/ppapi/c/private/ppb_talk_private.h
new file mode 100644
index 0000000..6c51325
--- /dev/null
+++ b/ppapi/c/private/ppb_talk_private.h
@@ -0,0 +1,58 @@
+/* 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 private/ppb_talk_private.idl modified Fri Mar 9 11:03:31 2012. */
+
+#ifndef PPAPI_C_PRIVATE_PPB_TALK_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_TALK_PRIVATE_H_
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_TALK_PRIVATE_INTERFACE_1_0 "PPB_Talk_Private;1.0"
+#define PPB_TALK_PRIVATE_INTERFACE PPB_TALK_PRIVATE_INTERFACE_1_0
+
+/**
+ * @file
+ * This file contains the <code>PPB_Talk</code> interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * Extra interface for Talk.
+ */
+struct PPB_Talk_Private_1_0 {
+ /**
+ * Creates a Talk_Private resource.
+ */
+ PP_Resource (*Create)(PP_Instance instance);
+ /**
+ * Displays security UI.
+ *
+ * The callback will be issued with PP_OK as the result of the user gave
+ * permission, or PP_ERROR_NOACCESS if the user denied.
+ *
+ * You can only have one call pending. It will return PP_OK_COMPLETIONPENDING
+ * if the request is queued, or PP_ERROR_INPROGRESS if there is already a
+ * request in progress.
+ */
+ int32_t (*GetPermission)(PP_Resource talk_resource,
+ struct PP_CompletionCallback callback);
+};
+
+typedef struct PPB_Talk_Private_1_0 PPB_Talk_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_TALK_PRIVATE_H_ */
+
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 0f6c83a..caa12f5 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -107,6 +107,8 @@
'proxy/ppb_message_loop_proxy.h',
'proxy/ppb_pdf_proxy.cc',
'proxy/ppb_pdf_proxy.h',
+ 'proxy/ppb_talk_private_proxy.cc',
+ 'proxy/ppb_talk_private_proxy.h',
'proxy/ppb_tcp_server_socket_private_proxy.cc',
'proxy/ppb_tcp_server_socket_private_proxy.h',
'proxy/ppb_tcp_socket_private_proxy.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 01b9aef..48180c6 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -219,6 +219,8 @@
'thunk/ppb_resource_array_thunk.cc',
'thunk/ppb_scrollbar_api.h',
'thunk/ppb_scrollbar_thunk.cc',
+ 'thunk/ppb_talk_private_api.h',
+ 'thunk/ppb_talk_private_thunk.cc',
'thunk/ppb_tcp_server_socket_private_api.h',
'thunk/ppb_tcp_server_socket_private_thunk.cc',
'thunk/ppb_tcp_socket_private_api.h',
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index ecaf13e..c169833 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -61,6 +61,7 @@
#include "ppapi/c/private/ppb_network_list_private.h"
#include "ppapi/c/private/ppb_network_monitor_private.h"
#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/c/private/ppb_talk_private.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/trusted/ppb_broker_trusted.h"
@@ -92,6 +93,7 @@
#include "ppapi/proxy/ppb_instance_proxy.h"
#include "ppapi/proxy/ppb_message_loop_proxy.h"
#include "ppapi/proxy/ppb_pdf_proxy.h"
+#include "ppapi/proxy/ppb_talk_private_proxy.h"
#include "ppapi/proxy/ppb_tcp_server_socket_private_proxy.h"
#include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_testing_proxy.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index dbcbbd1..4c74eac 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -309,6 +309,13 @@ IPC_MESSAGE_ROUTED2(
ppapi::HostResource /* filesystem */,
int32_t /* result */)
+// PPB_Talk
+IPC_MESSAGE_ROUTED3(
+ PpapiMsg_PPBTalk_GetPermissionACK,
+ uint32 /* plugin_dispatcher_id */,
+ PP_Resource /* resource */,
+ int32_t /* result */)
+
// PPB_TCPSocket_Private.
IPC_MESSAGE_ROUTED5(PpapiMsg_PPBTCPSocket_ConnectACK,
uint32 /* plugin_dispatcher_id */,
@@ -926,6 +933,12 @@ IPC_SYNC_MESSAGE_ROUTED2_1(
uint32_t /* table */,
std::string /* result */)
+// PPB_Talk.
+IPC_MESSAGE_ROUTED2(
+ PpapiHostMsg_PPBTalk_GetPermission,
+ uint32 /* plugin_dispatcher_id */,
+ PP_Resource /* resource */)
+
// PPB_Testing.
IPC_SYNC_MESSAGE_ROUTED3_1(
PpapiHostMsg_PPBTesting_ReadImageData,
diff --git a/ppapi/proxy/ppb_talk_private_proxy.cc b/ppapi/proxy/ppb_talk_private_proxy.cc
new file mode 100644
index 0000000..3b301f0
--- /dev/null
+++ b/ppapi/proxy/ppb_talk_private_proxy.cc
@@ -0,0 +1,92 @@
+// 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/proxy/ppb_talk_private_proxy.h"
+
+#include "ipc/ipc_message_macros.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/plugin_proxy_delegate.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_talk_private_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+class Talk : public Resource, public thunk::PPB_Talk_Private_API {
+ public:
+ Talk(PP_Instance instance) : Resource(OBJECT_IS_PROXY, instance) {
+ }
+
+ // Resource overrides.
+ thunk::PPB_Talk_Private_API* AsPPB_Talk_Private_API() { return this; }
+
+ // PPB_Talk_API implementation.
+ int32_t GetPermission(const PP_CompletionCallback& callback) {
+ if (TrackedCallback::IsPending(callback_))
+ return PP_ERROR_INPROGRESS;
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
+ pp_instance());
+ if (!dispatcher)
+ return PP_ERROR_FAILED;
+
+ callback_ = new TrackedCallback(this, callback);
+
+ if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
+ new PpapiHostMsg_PPBTalk_GetPermission(
+ API_ID_PPB_TALK,
+ dispatcher->plugin_dispatcher_id(),
+ pp_resource())))
+ return PP_OK_COMPLETIONPENDING;
+ return PP_ERROR_FAILED;
+ }
+
+ void GotCompletion(int32_t result) {
+ TrackedCallback::ClearAndRun(&callback_, result);
+ }
+
+ private:
+ scoped_refptr<TrackedCallback> callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(Talk);
+};
+
+} // namespace
+
+PPB_Talk_Private_Proxy::PPB_Talk_Private_Proxy(Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher) {
+}
+
+// static
+PP_Resource PPB_Talk_Private_Proxy::CreateProxyResource(PP_Instance instance) {
+ return (new Talk(instance))->GetReference();
+}
+
+bool PPB_Talk_Private_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(PPB_Talk_Private_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPBTalk_GetPermissionACK,
+ OnMsgGetPermissionACK)
+ IPC_MESSAGE_UNHANDLED(handled = false);
+ IPC_END_MESSAGE_MAP();
+ return handled;
+}
+
+void PPB_Talk_Private_Proxy::OnMsgGetPermissionACK(uint32 /* dispatcher_id */,
+ PP_Resource resource,
+ int32_t result) {
+ thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter(
+ resource, false);
+ if (enter.succeeded())
+ static_cast<Talk*>(enter.object())->GotCompletion(result);
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_talk_private_proxy.h b/ppapi/proxy/ppb_talk_private_proxy.h
new file mode 100644
index 0000000..62b0b80
--- /dev/null
+++ b/ppapi/proxy/ppb_talk_private_proxy.h
@@ -0,0 +1,38 @@
+// 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_PROXY_PPB_TALK_PRIVATE_PROXY_H_
+#define PPAPI_PROXY_PPB_TALK_PRIVATE_PROXY_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/shared_impl/api_id.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PPB_Talk_Private_Proxy : public InterfaceProxy {
+ public:
+ PPB_Talk_Private_Proxy(Dispatcher* dispatcher);
+
+ static PP_Resource CreateProxyResource(PP_Instance instance);
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ static const ApiID kApiID = API_ID_PPB_TALK;
+
+ private:
+ // Message handlers.
+ void OnMsgGetPermissionACK(uint32 dispatcher_id,
+ PP_Resource resource,
+ int32_t result);
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_Talk_Private_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_TALK_PRIVATE_PROXY_H_
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index 93112a8..b74840a 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -25,6 +25,7 @@
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_host_resolver_private_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
+#include "ppapi/proxy/ppb_talk_private_proxy.h"
#include "ppapi/proxy/ppb_tcp_server_socket_private_proxy.h"
#include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_udp_socket_private_proxy.h"
@@ -284,6 +285,10 @@ PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance,
return 0;
}
+PP_Resource ResourceCreationProxy::CreateTalk(PP_Instance instance) {
+ return PPB_Talk_Private_Proxy::CreateProxyResource(instance);
+}
+
#if !defined(OS_NACL)
PP_Resource ResourceCreationProxy::CreateTCPServerSocketPrivate(
PP_Instance instance) {
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 9e4f6c9..60c98fb 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -111,6 +111,7 @@ class ResourceCreationProxy : public InterfaceProxy,
uint32_t size) OVERRIDE;
virtual PP_Resource CreateScrollbar(PP_Instance instance,
PP_Bool vertical) OVERRIDE;
+ virtual PP_Resource CreateTalk(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateTCPServerSocketPrivate(
PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
diff --git a/ppapi/shared_impl/api_id.h b/ppapi/shared_impl/api_id.h
index baf92fa..f4f4a81 100644
--- a/ppapi/shared_impl/api_id.h
+++ b/ppapi/shared_impl/api_id.h
@@ -43,6 +43,7 @@ enum ApiID {
API_ID_PPB_SURFACE_3D,
API_ID_PPB_TCPSERVERSOCKET_PRIVATE,
API_ID_PPB_TCPSOCKET_PRIVATE,
+ API_ID_PPB_TALK,
API_ID_PPB_TESTING,
API_ID_PPB_TEXT_INPUT,
API_ID_PPB_UDPSOCKET_PRIVATE,
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 45b6fbf..cccc999 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -50,6 +50,7 @@
F(PPB_PDFFont_API) \
F(PPB_ResourceArray_API) \
F(PPB_Scrollbar_API) \
+ F(PPB_Talk_Private_API) \
F(PPB_TCPServerSocket_Private_API) \
F(PPB_TCPSocket_Private_API) \
F(PPB_Transport_API) \
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index b19723a..43776b0 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -9,6 +9,7 @@
PROXIED_API(PPB_Broker)
PROXIED_API(PPB_HostResolver_Private)
+PROXIED_API(PPB_Talk_Private)
PROXIED_API(PPB_TCPServerSocket_Private)
PROXIED_API(PPB_TCPSocket_Private)
PROXIED_API(PPB_UDPSocket_Private)
@@ -32,6 +33,8 @@ PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
PPB_NetAddress_Private_0_1)
PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_1_0,
PPB_NetAddress_Private_1_0)
+PROXIED_IFACE(PPB_Talk_Private, PPB_TALK_PRIVATE_INTERFACE_1_0,
+ PPB_Talk_Private_1_0)
PROXIED_IFACE(PPB_TCPServerSocket_Private,
PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1,
PPB_TCPServerSocket_Private_0_1)
diff --git a/ppapi/thunk/ppb_talk_private_api.h b/ppapi/thunk/ppb_talk_private_api.h
new file mode 100644
index 0000000..8f5244d
--- /dev/null
+++ b/ppapi/thunk/ppb_talk_private_api.h
@@ -0,0 +1,23 @@
+// 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_TALK_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_TALK_PRIVATE_API_H_
+
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Talk_Private_API {
+ public:
+ virtual ~PPB_Talk_Private_API() {}
+
+ virtual int32_t GetPermission(const PP_CompletionCallback& callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TALK_PRIVATE_API_H_
diff --git a/ppapi/thunk/ppb_talk_private_thunk.cc b/ppapi/thunk/ppb_talk_private_thunk.cc
new file mode 100644
index 0000000..3e3775c
--- /dev/null
+++ b/ppapi/thunk/ppb_talk_private_thunk.cc
@@ -0,0 +1,43 @@
+// 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/c/pp_errors.h"
+#include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_talk_private_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTalk(instance);
+}
+
+int32_t GetPermission(PP_Resource resource,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Talk_Private_API> enter(resource, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->GetPermission(callback);
+}
+
+const PPB_Talk_Private_1_0 g_ppb_talk_private_thunk = {
+ &Create,
+ &GetPermission
+};
+
+} // namespace
+
+const PPB_Talk_Private_1_0* GetPPB_Talk_Private_1_0_Thunk() {
+ return &g_ppb_talk_private_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index a9032bf..536c967 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -114,6 +114,7 @@ class ResourceCreationAPI {
uint32_t size) = 0;
virtual PP_Resource CreateScrollbar(PP_Instance instance,
PP_Bool vertical) = 0;
+ virtual PP_Resource CreateTalk(PP_Instance instance) = 0;
virtual PP_Resource CreateTCPServerSocketPrivate(PP_Instance instance) = 0;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0;
virtual PP_Resource CreateTransport(PP_Instance instance,