0

ppapi: PPB_VpnProvider: Define API

tbr=sky@chromium.org for trivial change to chrome/common/ppapi_utils.

BUG=506490

Review-Url: https://codereview.chromium.org/1726303003
Cr-Commit-Position: refs/heads/master@{#393345}
This commit is contained in:
adrian.belgun
2016-05-12 13:44:07 -07:00
committed by Commit bot
parent f25a299b4a
commit 000bd49898
25 changed files with 722 additions and 0 deletions

@ -69,6 +69,7 @@
#include "ppapi/c/ppb_video_encoder.h"
#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/c/ppb_view.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
#include "ppapi/c/private/ppb_camera_device_private.h"

@ -96,6 +96,7 @@
#include "ppapi/c/ppb_video_encoder.h"
#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/c/ppb_view.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"

@ -348,6 +348,10 @@ PP_Resource ResourceCreationImpl::CreateVideoSource(PP_Instance instance) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateVpnProvider(PP_Instance instance) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateWheelInputEvent(
PP_Instance instance,
PP_TimeTicks time_stamp,

@ -132,6 +132,7 @@ class ResourceCreationImpl : public ppapi::thunk::ResourceCreationAPI {
PP_Resource CreateVideoDestination(PP_Instance instance) override;
PP_Resource CreateVideoEncoder(PP_Instance instance) override;
PP_Resource CreateVideoSource(PP_Instance instance) override;
PP_Resource CreateVpnProvider(PP_Instance instance) override;
PP_Resource CreateWheelInputEvent(PP_Instance instance,
PP_TimeTicks time_stamp,
uint32_t modifiers,

@ -65,6 +65,7 @@
'ppb_video_encoder.h',
'ppb_video_frame.h',
'ppb_view.h',
'ppb_vpn_provider.h',
'ppb_websocket.h',
'pp_codecs.h',
'pp_completion_callback.h',

@ -61,6 +61,7 @@
'video_encoder.cc',
'video_frame.cc',
'view.cc',
'vpn_provider.cc',
'websocket.cc',
# ppapi/cpp/dev
@ -145,6 +146,7 @@
'video_encoder.h',
'video_frame.h',
'view.h',
'vpn_provider.h',
'websocket.h',
],
'DEST': 'include/ppapi/cpp',

@ -0,0 +1,159 @@
/* Copyright 2016 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_VpnProvider</code> interface.
*/
[generate_thunk]
label Chrome {
[channel=dev] M52 = 0.1
};
/**
* Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
* Important: This API is available only on Chrome OS.
*
* This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by
* providing a high performance path for packet handling.
*
* Permissions: Apps permission <code>vpnProvider</code> is required for
* <code>PPB_VpnProvider.Bind()</code>.
*
* Typical usage:
* - Create a <code>PPB_VpnProvider</code> instance.
* - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>.
* - In the extension follow the usual workflow for configuring a VPN connection
* via the <code>chrome.vpnProvider</code> API until the step for notifying
* the connection state as "connected".
* - Bind to the previously created connection using
* <code>PPB_VpnProvider.Bind()</code>.
* - Notify the connection state as "connected" from JavaScript using
* <code>chrome.vpnProvider.notifyConnectionStateChanged</code>.
* - When the steps above are completed without errors, a virtual tunnel is
* created to the network stack of Chrome OS. IP packets can be sent through
* the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets
* originating on the Chrome OS device will be received using the callback
* registered for <code>PPB_VpnProvider.ReceivePacket()</code>.
* - When the user disconnects from the VPN configuration or there is an error
* the extension will be notfied via
* <code>chrome.vpnProvider.onPlatformMessage</code>.
*/
interface PPB_VpnProvider {
/**
* Create() creates a VpnProvider instance.
*
* @param[in] instance A <code>PP_Instance</code> identifying the instance
* with the VpnProvider.
*
* @return A <code>PP_Resource</code> corresponding to a VpnProvider if
* successful.
*/
PP_Resource Create([in] PP_Instance instance);
/**
* IsVpnProvider() determines if the provided <code>resource</code> is a
* VpnProvider instance.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
* <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
* <code>resource</code> is invalid or some type other than
* <code>PPB_VpnProvider</code>.
*/
PP_Bool IsVpnProvider([in] PP_Resource resource);
/**
* Bind() binds to an existing configuration created from JavaScript by
* <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
* via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should
* register the callback for <code>ReceivePacket</code> before calling
* <code>Bind()</code>.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing
* the configuration id from the callback of
* <code>chrome.vpnProvider.createConfig</code>.
*
* @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing
* the configuration name as defined by the user when calling
* <code>chrome.vpnProvider.createConfig</code>.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>Bind()</code> has not completed.
* Returns <code>PP_ERROR_BADARGUMENT</code> if either
* <code>configuration_id</code> or <code>configuration_name</code> are not of
* type <code>PP_VARTYPE_STRING</code>.
* Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the
* required "vpnProvider" permission.
* Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and
* <code>connection_name</code> could not be matched with the existing
* connection, or if the plugin originates from a different extension than the
* one that created the connection.
*/
int32_t Bind([in] PP_Resource vpn_provider,
[in] PP_Var configuration_id,
[in] PP_Var configuration_name,
[in] PP_CompletionCallback callback);
/**
* SendPacket() sends an IP packet through the tunnel created for the VPN
* session. This will succeed only when the VPN session is owned by the
* module and the connection is bound.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
* an IP packet to be sent to the platform.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_FAILED</code> if the connection is not bound.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>SendPacket()</code> has not completed.
* Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of
* type <code>PP_VARTYPE_ARRAY_BUFFER</code>.
*/
int32_t SendPacket([in] PP_Resource vpn_provider,
[in] PP_Var packet,
[in] PP_CompletionCallback callback);
/**
* ReceivePacket() receives an IP packet from the tunnel for the VPN session.
* This function only returns a single packet. This function must be called at
* least N times to receive N packets, no matter the size of each packet. The
* callback should be registered before calling <code>Bind()</code>.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[out] packet The received packet is copied to provided
* <code>packet</code>. The <code>packet</code> must remain valid until
* ReceivePacket() completes. Its received <code>PP_VarType</code> will be
* <code>PP_VARTYPE_ARRAY_BUFFER</code>.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>ReceivePacket()</code> has not completed.
*/
int32_t ReceivePacket([in] PP_Resource vpn_provider,
[out] PP_Var packet,
[in] PP_CompletionCallback callback);
};

175
ppapi/c/ppb_vpn_provider.h Normal file

@ -0,0 +1,175 @@
/* Copyright 2016 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 ppb_vpn_provider.idl modified Fri May 6 20:42:01 2016. */
#ifndef PPAPI_C_PPB_VPN_PROVIDER_H_
#define PPAPI_C_PPB_VPN_PROVIDER_H_
#include "ppapi/c/pp_bool.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"
#include "ppapi/c/pp_var.h"
#define PPB_VPNPROVIDER_INTERFACE_0_1 "PPB_VpnProvider;0.1" /* dev */
/**
* @file
* This file defines the <code>PPB_VpnProvider</code> interface.
*/
/**
* @addtogroup Interfaces
* @{
*/
/**
* Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
* Important: This API is available only on Chrome OS.
*
* This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by
* providing a high performance path for packet handling.
*
* Permissions: Apps permission <code>vpnProvider</code> is required for
* <code>PPB_VpnProvider.Bind()</code>.
*
* Typical usage:
* - Create a <code>PPB_VpnProvider</code> instance.
* - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>.
* - In the extension follow the usual workflow for configuring a VPN connection
* via the <code>chrome.vpnProvider</code> API until the step for notifying
* the connection state as "connected".
* - Bind to the previously created connection using
* <code>PPB_VpnProvider.Bind()</code>.
* - Notify the connection state as "connected" from JavaScript using
* <code>chrome.vpnProvider.notifyConnectionStateChanged</code>.
* - When the steps above are completed without errors, a virtual tunnel is
* created to the network stack of Chrome OS. IP packets can be sent through
* the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets
* originating on the Chrome OS device will be received using the callback
* registered for <code>PPB_VpnProvider.ReceivePacket()</code>.
* - When the user disconnects from the VPN configuration or there is an error
* the extension will be notfied via
* <code>chrome.vpnProvider.onPlatformMessage</code>.
*/
struct PPB_VpnProvider_0_1 { /* dev */
/**
* Create() creates a VpnProvider instance.
*
* @param[in] instance A <code>PP_Instance</code> identifying the instance
* with the VpnProvider.
*
* @return A <code>PP_Resource</code> corresponding to a VpnProvider if
* successful.
*/
PP_Resource (*Create)(PP_Instance instance);
/**
* IsVpnProvider() determines if the provided <code>resource</code> is a
* VpnProvider instance.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
* <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
* <code>resource</code> is invalid or some type other than
* <code>PPB_VpnProvider</code>.
*/
PP_Bool (*IsVpnProvider)(PP_Resource resource);
/**
* Bind() binds to an existing configuration created from JavaScript by
* <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
* via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should
* register the callback for <code>ReceivePacket</code> before calling
* <code>Bind()</code>.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing
* the configuration id from the callback of
* <code>chrome.vpnProvider.createConfig</code>.
*
* @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing
* the configuration name as defined by the user when calling
* <code>chrome.vpnProvider.createConfig</code>.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>Bind()</code> has not completed.
* Returns <code>PP_ERROR_BADARGUMENT</code> if either
* <code>configuration_id</code> or <code>configuration_name</code> are not of
* type <code>PP_VARTYPE_STRING</code>.
* Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the
* required "vpnProvider" permission.
* Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and
* <code>connection_name</code> could not be matched with the existing
* connection, or if the plugin originates from a different extension than the
* one that created the connection.
*/
int32_t (*Bind)(PP_Resource vpn_provider,
struct PP_Var configuration_id,
struct PP_Var configuration_name,
struct PP_CompletionCallback callback);
/**
* SendPacket() sends an IP packet through the tunnel created for the VPN
* session. This will succeed only when the VPN session is owned by the
* module and the connection is bound.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
* an IP packet to be sent to the platform.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_FAILED</code> if the connection is not bound.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>SendPacket()</code> has not completed.
* Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of
* type <code>PP_VARTYPE_ARRAY_BUFFER</code>.
*/
int32_t (*SendPacket)(PP_Resource vpn_provider,
struct PP_Var packet,
struct PP_CompletionCallback callback);
/**
* ReceivePacket() receives an IP packet from the tunnel for the VPN session.
* This function only returns a single packet. This function must be called at
* least N times to receive N packets, no matter the size of each packet. The
* callback should be registered before calling <code>Bind()</code>.
*
* @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
* VpnProvider.
*
* @param[out] packet The received packet is copied to provided
* <code>packet</code>. The <code>packet</code> must remain valid until
* ReceivePacket() completes. Its received <code>PP_VarType</code> will be
* <code>PP_VARTYPE_ARRAY_BUFFER</code>.
*
* @param[in] callback A <code>PP_CompletionCallback</code> called on
* completion.
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
* <code>ReceivePacket()</code> has not completed.
*/
int32_t (*ReceivePacket)(PP_Resource vpn_provider,
struct PP_Var* packet,
struct PP_CompletionCallback callback);
};
/**
* @}
*/
#endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */

68
ppapi/cpp/vpn_provider.cc Normal file

@ -0,0 +1,68 @@
// Copyright 2016 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/vpn_provider.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var_array.h"
namespace pp {
namespace {
template <>
const char* interface_name<PPB_VpnProvider_0_1>() {
return PPB_VPNPROVIDER_INTERFACE_0_1;
}
} // namespace
VpnProvider::VpnProvider(const InstanceHandle& instance)
: associated_instance_(instance) {
if (has_interface<PPB_VpnProvider_0_1>()) {
PassRefFromConstructor(get_interface<PPB_VpnProvider_0_1>()->Create(
associated_instance_.pp_instance()));
}
}
VpnProvider::~VpnProvider() {}
// static
bool VpnProvider::IsAvailable() {
return has_interface<PPB_VpnProvider_0_1>();
}
int32_t VpnProvider::Bind(const Var& configuration_id,
const Var& configuration_name,
const CompletionCallback& callback) {
if (has_interface<PPB_VpnProvider_0_1>()) {
return get_interface<PPB_VpnProvider_0_1>()->Bind(
pp_resource(), configuration_id.pp_var(), configuration_name.pp_var(),
callback.pp_completion_callback());
}
return PP_ERROR_NOINTERFACE;
}
int32_t VpnProvider::SendPacket(const Var& packet,
const CompletionCallback& callback) {
if (has_interface<PPB_VpnProvider_0_1>()) {
return get_interface<PPB_VpnProvider_0_1>()->SendPacket(
pp_resource(), packet.pp_var(), callback.pp_completion_callback());
}
return PP_ERROR_NOINTERFACE;
}
int32_t VpnProvider::ReceivePacket(
const CompletionCallbackWithOutput<Var>& callback) {
if (has_interface<PPB_VpnProvider_0_1>()) {
return get_interface<PPB_VpnProvider_0_1>()->ReceivePacket(
pp_resource(), callback.output(), callback.pp_completion_callback());
}
return PP_ERROR_NOINTERFACE;
}
} // namespace pp

135
ppapi/cpp/vpn_provider.h Normal file

@ -0,0 +1,135 @@
// Copyright 2016 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_VPN_PROVIDER_H_
#define PPAPI_CPP_VPN_PROVIDER_H_
#include <string>
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/cpp/completion_callback.h"
namespace pp {
class InstanceHandle;
/// @file
/// This file defines the VpnProvider interface providing a way to implement a
/// VPN client.
/// Important: This API is available only on Chrome OS.
/// The <code>VpnProvider</code> class enhances the
/// <code>chrome.vpnProvider</code> JavaScript API by providing a high
/// performance path for packet handling.
///
/// Permissions: Apps permission <code>vpnProvider</code> is required for
/// <code>VpnProvider.Bind()</code>.
///
/// Typical usage:
/// - Create a <code>VpnProvider</code> instance.
/// - Register the callback for <code>VpnProvider.ReceivePacket()</code>.
/// - In the extension follow the usual workflow for configuring a VPN
/// connection via the <code>chrome.vpnProvider</code> API until the step for
/// notifying the connection state as "connected".
/// - Bind to the previously created connection using
/// <code>VpnProvider.Bind()</code>.
/// - Notify the connection state as "connected" from JavaScript using
/// <code>chrome.vpnProvider.notifyConnectionStateChanged</code>.
/// - When the steps above are completed without errors, a virtual tunnel is
/// created to the network stack of Chrome OS. IP packets can be sent through
/// the tunnel using <code>VpnProvider.SendPacket()</code> and any packets
/// originating on the Chrome OS device will be received using the callback
/// registered for <code>VpnProvider.ReceivePacket()</code>.
/// - When the user disconnects from the VPN configuration or there is an error
/// the extension will be notfied via
/// <code>chrome.vpnProvider.onPlatformMessage</code>.
class VpnProvider : public Resource {
public:
/// Constructs a VpnProvider object.
///
/// @param[in] instance The instance with which this resource will be
/// associated.
explicit VpnProvider(const InstanceHandle& instance);
/// Destructs a VpnProvider object.
virtual ~VpnProvider();
/// Static function for determining whether the browser supports the
/// <code>VpnProvider</code> interface.
///
/// @return true if the interface is available, false otherwise.
static bool IsAvailable();
/// Binds to an existing configuration created from JavaScript by
/// <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
/// via <code>SendPacket</code> and <code>ReceivePacket</code>. The user
/// should register the callback for <code>ReceivePacket</code> before calling
/// <code>Bind()</code>.
///
/// @param[in] configuration_id The configuration id from the callback of
/// <code>chrome.vpnProvider.createConfig</code>. This <code>Var</code> must
/// be of string type.
///
/// @param[in] configuration_name The configuration name as defined by the
/// user when calling <code>chrome.vpnProvider.createConfig</code>. This
/// <code>Var</code> must be of string type.
///
/// @param[in] callback A <code>CompletionCallback</code> to be called on
/// completion.
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
/// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
/// <code>Bind()</code> has not completed.
/// Returns <code>PP_ERROR_BADARGUMENT</code> if the <code>Var</code> type of
/// either <code>configuration_id</code> or <code>configuration_name</code> is
/// not of string type.
/// Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the
/// required "vpnProvider" permission.
/// Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and
/// <code>connection_name</code> could not be matched with the existing
/// connection, or if the plugin originates from a different extension than
/// the one that created the connection.
int32_t Bind(const Var& configuration_id,
const Var& configuration_name,
const CompletionCallback& callback);
/// Sends an IP packet through the tunnel created for the VPN session. This
/// will succeed only when the VPN session is owned by the module and
/// connection is bound.
///
/// @param[in] packet IP packet to be sent to the platform. The
/// <code>Var</code> must be of ArrayBuffer type.
///
/// @param[in] callback A <code>CompletionCallback</code> to be called on
/// completion.
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
/// Returns <code>PP_ERROR_FAILED</code> if the connection is not bound.
/// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
/// <code>SendPacket()</code> has not completed.
/// Returns <code>PP_ERROR_BADARGUMENT</code> if the <code>Var</code> type of
/// <code>packet</code> is not of ArrayBuffer type.
int32_t SendPacket(const Var& packet, const CompletionCallback& callback);
/// Receives an IP packet from the tunnel for the VPN session. This function
/// only returns a single packet. That is, this function must be called at
/// least N times to receive N packets, no matter the size of each packet. The
/// callback should be registered before calling <code>Bind()</code>.
///
/// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
/// called upon completion of ReceivePacket. It will be passed an ArrayBuffer
/// type <code>Var</code> containing an IP packet to be sent to the platform.
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
/// Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
/// <code>ReceivePacket()</code> has not completed.
int32_t ReceivePacket(const CompletionCallbackWithOutput<Var>& callback);
private:
InstanceHandle associated_instance_;
};
} // namespace pp
#endif // PPAPI_CPP_VPN_PROVIDER_H_

@ -49,6 +49,7 @@
#include "ppapi/c/ppb_var_dictionary.h"
#include "ppapi/c/ppb_video_decoder.h"
#include "ppapi/c/ppb_video_encoder.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/private/ppb_camera_device_private.h"
@ -150,6 +151,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_1_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VpnProvider_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3;
@ -2511,6 +2513,35 @@ static void Pnacl_M44_PPB_VideoEncoder_Close(PP_Resource video_encoder) {
/* Not generating wrapper methods for PPB_View_1_2 */
/* Begin wrapper methods for PPB_VpnProvider_0_1 */
static PP_Resource Pnacl_M52_PPB_VpnProvider_Create(PP_Instance instance) {
const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface;
return iface->Create(instance);
}
static PP_Bool Pnacl_M52_PPB_VpnProvider_IsVpnProvider(PP_Resource resource) {
const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface;
return iface->IsVpnProvider(resource);
}
static int32_t Pnacl_M52_PPB_VpnProvider_Bind(PP_Resource vpn_provider, struct PP_Var* configuration_id, struct PP_Var* configuration_name, struct PP_CompletionCallback* callback) {
const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface;
return iface->Bind(vpn_provider, *configuration_id, *configuration_name, *callback);
}
static int32_t Pnacl_M52_PPB_VpnProvider_SendPacket(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback* callback) {
const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface;
return iface->SendPacket(vpn_provider, *packet, *callback);
}
static int32_t Pnacl_M52_PPB_VpnProvider_ReceivePacket(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback* callback) {
const struct PPB_VpnProvider_0_1 *iface = Pnacl_WrapperInfo_PPB_VpnProvider_0_1.real_iface;
return iface->ReceivePacket(vpn_provider, packet, *callback);
}
/* End wrapper methods for PPB_VpnProvider_0_1 */
/* Begin wrapper methods for PPB_WebSocket_1_0 */
static PP_Resource Pnacl_M18_PPB_WebSocket_Create(PP_Instance instance) {
@ -5298,6 +5329,14 @@ static const struct PPB_VideoEncoder_0_2 Pnacl_Wrappers_PPB_VideoEncoder_0_2 = {
/* Not generating wrapper interface for PPB_View_1_2 */
static const struct PPB_VpnProvider_0_1 Pnacl_Wrappers_PPB_VpnProvider_0_1 = {
.Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M52_PPB_VpnProvider_Create,
.IsVpnProvider = (PP_Bool (*)(PP_Resource resource))&Pnacl_M52_PPB_VpnProvider_IsVpnProvider,
.Bind = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var configuration_id, struct PP_Var configuration_name, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_Bind,
.SendPacket = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var packet, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_SendPacket,
.ReceivePacket = (int32_t (*)(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback callback))&Pnacl_M52_PPB_VpnProvider_ReceivePacket
};
static const struct PPB_WebSocket_1_0 Pnacl_Wrappers_PPB_WebSocket_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M18_PPB_WebSocket_Create,
.IsWebSocket = (PP_Bool (*)(PP_Resource resource))&Pnacl_M18_PPB_WebSocket_IsWebSocket,
@ -6253,6 +6292,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoEncoder_0_2 = {
.real_iface = NULL
};
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VpnProvider_0_1 = {
.iface_macro = PPB_VPNPROVIDER_INTERFACE_0_1,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_VpnProvider_0_1,
.real_iface = NULL
};
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0 = {
.iface_macro = PPB_WEBSOCKET_INTERFACE_1_0,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_WebSocket_1_0,
@ -6641,6 +6686,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_VideoDecoder_1_1,
&Pnacl_WrapperInfo_PPB_VideoEncoder_0_1,
&Pnacl_WrapperInfo_PPB_VideoEncoder_0_2,
&Pnacl_WrapperInfo_PPB_VpnProvider_0_1,
&Pnacl_WrapperInfo_PPB_WebSocket_1_0,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4,

@ -289,6 +289,8 @@
'thunk/ppb_view_api.h',
'thunk/ppb_view_dev_thunk.cc',
'thunk/ppb_view_thunk.cc',
'thunk/ppb_vpn_provider_api.h',
'thunk/ppb_vpn_provider_thunk.cc',
'thunk/ppb_websocket_api.h',
'thunk/ppb_websocket_thunk.cc',
'thunk/ppb_x509_certificate_private_api.h',

@ -68,6 +68,7 @@
'c/ppb_video_encoder.h',
'c/ppb_video_frame.h',
'c/ppb_view.h',
'c/ppb_ppb_vpn_provider.h',
'c/ppb_websocket.h',
'c/ppp.h',
'c/ppp_graphics_3d.h',
@ -246,6 +247,8 @@
'cpp/video_frame.h',
'cpp/view.cc',
'cpp/view.h',
'cpp/vpn_provider.h',
'cpp/vpn_provider.cc',
'cpp/websocket.cc',
'cpp/websocket.h',

@ -70,6 +70,7 @@
#include "ppapi/c/ppb_video_encoder.h"
#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/c/ppb_view.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
#include "ppapi/c/private/ppb_camera_device_private.h"

@ -409,6 +409,10 @@ PP_Resource ResourceCreationProxy::CreateVideoSource(
return (new VideoSourceResource(GetConnection(), instance))->GetReference();
}
PP_Resource ResourceCreationProxy::CreateVpnProvider(PP_Instance instance) {
return 0;
}
PP_Resource ResourceCreationProxy::CreateWebSocket(PP_Instance instance) {
return (new WebSocketResource(GetConnection(), instance))->GetReference();
}

@ -160,6 +160,7 @@ class ResourceCreationProxy : public InterfaceProxy,
PP_Resource CreateVideoDestination(PP_Instance instance) override;
PP_Resource CreateVideoEncoder(PP_Instance instance) override;
PP_Resource CreateVideoSource(PP_Instance instance) override;
PP_Resource CreateVpnProvider(PP_Instance instance) override;
PP_Resource CreateWebSocket(PP_Instance instance) override;
PP_Resource CreateX509CertificatePrivate(PP_Instance instance) override;
#if !defined(OS_NACL)

@ -89,6 +89,7 @@
F(PPB_VideoLayer_API) \
F(PPB_VideoSource_Private_API) \
F(PPB_View_API) \
F(PPB_VpnProvider_API) \
F(PPB_WebSocket_API) \
F(PPB_Widget_API) \
F(PPB_X509Certificate_Private_API)

@ -86,6 +86,7 @@
#include "ppapi/c/ppb_var_array_buffer.h"
#include "ppapi/c/ppb_var_dictionary.h"
#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_graphics_3d.h"

@ -76,6 +76,7 @@
#include "ppapi/cpp/var_array_buffer.h"
#include "ppapi/cpp/var_dictionary.h"
#include "ppapi/cpp/video_frame.h"
#include "ppapi/cpp/vpn_provider.h"
#include "ppapi/cpp/websocket.h"
#include "ppapi/utility/completion_callback_factory.h"
#include "ppapi/utility/completion_callback_factory_thread_traits.h"

@ -138,6 +138,8 @@ source_set("thunk") {
"ppb_view_api.h",
"ppb_view_dev_thunk.cc",
"ppb_view_thunk.cc",
"ppb_vpn_provider_api.h",
"ppb_vpn_provider_thunk.cc",
"ppb_websocket_api.h",
"ppb_websocket_thunk.cc",
"ppb_x509_certificate_private_api.h",

@ -14,6 +14,7 @@ PROXIED_IFACE(PPB_COMPOSITORLAYER_INTERFACE_0_1, PPB_CompositorLayer_0_1)
PROXIED_IFACE(PPB_COMPOSITORLAYER_INTERFACE_0_2, PPB_CompositorLayer_0_2)
PROXIED_IFACE(PPB_VIDEODECODER_INTERFACE_0_1, PPB_VideoDecoder_0_1)
PROXIED_IFACE(PPB_VIDEOENCODER_INTERFACE_0_1, PPB_VideoEncoder_0_1)
PROXIED_IFACE(PPB_VPNPROVIDER_INTERFACE_0_1, PPB_VpnProvider_0_1)
// Note, PPB_TraceEvent is special. We don't want to actually make it stable,
// but we want developers to be able to leverage it when running Chrome Dev or

@ -0,0 +1,31 @@
// 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.
#ifndef PPAPI_THUNK_PPB_VPNPROVIDER_API_H_
#define PPAPI_THUNK_PPB_VPNPROVIDER_API_H_
#include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi {
namespace thunk {
class PPAPI_THUNK_EXPORT PPB_VpnProvider_API {
public:
virtual ~PPB_VpnProvider_API() {}
virtual int32_t Bind(const PP_Var& configuration_id,
const PP_Var& configuration_name,
const scoped_refptr<TrackedCallback>& callback) = 0;
virtual int32_t SendPacket(
const PP_Var& packet,
const scoped_refptr<TrackedCallback>& callback) = 0;
virtual int32_t ReceivePacket(
PP_Var* packet,
const scoped_refptr<TrackedCallback>& callback) = 0;
};
} // namespace thunk
} // namespace ppapi
#endif // PPAPI_THUNK_PPB_VPNPROVIDER_API_H_

@ -0,0 +1,79 @@
// Copyright 2016 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 ppb_vpn_provider.idl modified Fri May 6 20:38:30 2016.
#include <stdint.h>
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_vpn_provider.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
#include "ppapi/thunk/ppb_vpn_provider_api.h"
namespace ppapi {
namespace thunk {
namespace {
PP_Resource Create(PP_Instance instance) {
VLOG(4) << "PPB_VpnProvider::Create()";
EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
return enter.functions()->CreateVpnProvider(instance);
}
PP_Bool IsVpnProvider(PP_Resource resource) {
VLOG(4) << "PPB_VpnProvider::IsVpnProvider()";
EnterResource<PPB_VpnProvider_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
}
int32_t Bind(PP_Resource vpn_provider,
struct PP_Var configuration_id,
struct PP_Var configuration_name,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_VpnProvider::Bind()";
EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->Bind(
configuration_id, configuration_name, enter.callback()));
}
int32_t SendPacket(PP_Resource vpn_provider,
struct PP_Var packet,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_VpnProvider::SendPacket()";
EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->SendPacket(packet, enter.callback()));
}
int32_t ReceivePacket(PP_Resource vpn_provider,
struct PP_Var* packet,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_VpnProvider::ReceivePacket()";
EnterResource<PPB_VpnProvider_API> enter(vpn_provider, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(
enter.object()->ReceivePacket(packet, enter.callback()));
}
const PPB_VpnProvider_0_1 g_ppb_vpnprovider_thunk_0_1 = {
&Create, &IsVpnProvider, &Bind, &SendPacket, &ReceivePacket};
} // namespace
PPAPI_THUNK_EXPORT const PPB_VpnProvider_0_1* GetPPB_VpnProvider_0_1_Thunk() {
return &g_ppb_vpnprovider_thunk_0_1;
}
} // namespace thunk
} // namespace ppapi

@ -179,6 +179,7 @@ class ResourceCreationAPI {
virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0;
virtual PP_Resource CreateVideoEncoder(PP_Instance instance) = 0;
virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0;
virtual PP_Resource CreateVpnProvider(PP_Instance instance) = 0;
virtual PP_Resource CreateWebSocket(PP_Instance instance) = 0;
virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0;
#if !defined(OS_NACL)

@ -81811,6 +81811,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1978180250" label="PPB_Flash_Clipboard;5.1"/>
<int value="1980463089" label="PPB_View;1.1"/>
<int value="1981643755" label="PPB_FileMapping;0.1"/>
<int value="1990584694" label="PPB_VpnProvider;0.1"/>
<int value="1994108724" label="PPB_Flash_File_FileRef;2"/>
<int value="1997668256" label="PPB_GLESChromiumTextureMapping(Dev);0.1"/>
<int value="1998274350" label="PPB_Font(Dev);0.6"/>