Commit d2e03f81 authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Add NetworkList/NetworkMonitor hooks and C++ wrappers.

BUG=114808


Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=124797

Review URL: http://codereview.chromium.org/9545010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124927 0039d316-1c4b-4281-b951-d872f2087c98
parent 61cf2db3
...@@ -16,20 +16,25 @@ label Chrome { ...@@ -16,20 +16,25 @@ label Chrome {
*/ */
[assert_size(4)] [assert_size(4)]
enum PP_NetworkListType_Private { enum PP_NetworkListType_Private {
/**
* Type of the network interface is not known.
*/
PP_NETWORKLIST_UNKNOWN = 0,
/** /**
* Wired Ethernet network. * Wired Ethernet network.
*/ */
PP_NETWORKLIST_ETHERNET = 0, PP_NETWORKLIST_ETHERNET = 1,
/** /**
* Wireless Wi-Fi network. * Wireless Wi-Fi network.
*/ */
PP_NETWORKLIST_WIFI = 1, PP_NETWORKLIST_WIFI = 2,
/** /**
* Cellular network (e.g. LTE). * Cellular network (e.g. LTE).
*/ */
PP_NETWORKLIST_CELLULAR = 2 PP_NETWORKLIST_CELLULAR = 3
}; };
/** /**
...@@ -85,15 +90,15 @@ interface PPB_NetworkList_Private { ...@@ -85,15 +90,15 @@ interface PPB_NetworkList_Private {
* @return Returns type of the network interface with the specified * @return Returns type of the network interface with the specified
* <code>index</code>. * <code>index</code>.
*/ */
PP_NetworkListType_Private GetType([in] PP_Resource resource, PP_NetworkListType_Private GetType([in] PP_Resource resource,
[in] uint32_t index); [in] uint32_t index);
/** /**
* @return Returns current state of the network interface with the * @return Returns current state of the network interface with the
* specified <code>index</code>. * specified <code>index</code>.
*/ */
PP_NetworkListState_Private GetState([in] PP_Resource resource, PP_NetworkListState_Private GetState([in] PP_Resource resource,
[in] uint32_t index); [in] uint32_t index);
/** /**
* Gets list of IP addresses for the network interface with the * Gets list of IP addresses for the network interface with the
...@@ -108,8 +113,8 @@ interface PPB_NetworkList_Private { ...@@ -108,8 +113,8 @@ interface PPB_NetworkList_Private {
int32_t GetIpAddresses( int32_t GetIpAddresses(
[in] PP_Resource resource, [in] PP_Resource resource,
[in] uint32_t index, [in] uint32_t index,
[out, size_is(count)] PP_NetAddress_Private[] addresses, [inout, size_is(count)] PP_NetAddress_Private[] addresses,
[in] int32_t count); [in] uint32_t count);
/** /**
* @return Returns display name for the network interface with the * @return Returns display name for the network interface with the
...@@ -120,7 +125,7 @@ interface PPB_NetworkList_Private { ...@@ -120,7 +125,7 @@ interface PPB_NetworkList_Private {
/** /**
* @return Returns MTU for the network interface with the specified * @return Returns MTU for the network interface with the specified
* <code>index</code>. * <code>index</code> or 0 if MTU is unknown.
*/ */
uint32_t GetMTU([in] PP_Resource resource, uint32_t GetMTU([in] PP_Resource resource,
[in] uint32_t index); [in] uint32_t index);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*/ */
/* From private/ppb_network_list_private.idl, /* From private/ppb_network_list_private.idl,
* modified Fri Feb 24 10:14:10 2012. * modified Thu Mar 1 16:24:33 2012.
*/ */
#ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_
...@@ -34,18 +34,22 @@ ...@@ -34,18 +34,22 @@
* Type of a network interface. * Type of a network interface.
*/ */
typedef enum { typedef enum {
/**
* Type of the network interface is not known.
*/
PP_NETWORKLIST_UNKNOWN = 0,
/** /**
* Wired Ethernet network. * Wired Ethernet network.
*/ */
PP_NETWORKLIST_ETHERNET = 0, PP_NETWORKLIST_ETHERNET = 1,
/** /**
* Wireless Wi-Fi network. * Wireless Wi-Fi network.
*/ */
PP_NETWORKLIST_WIFI = 1, PP_NETWORKLIST_WIFI = 2,
/** /**
* Cellular network (e.g. LTE). * Cellular network (e.g. LTE).
*/ */
PP_NETWORKLIST_CELLULAR = 2 PP_NETWORKLIST_CELLULAR = 3
} PP_NetworkListType_Private; } PP_NetworkListType_Private;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType_Private, 4); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType_Private, 4);
...@@ -122,8 +126,8 @@ struct PPB_NetworkList_Private_0_2 { ...@@ -122,8 +126,8 @@ struct PPB_NetworkList_Private_0_2 {
*/ */
int32_t (*GetIpAddresses)(PP_Resource resource, int32_t (*GetIpAddresses)(PP_Resource resource,
uint32_t index, uint32_t index,
struct PP_NetAddress_Private* addresses[], struct PP_NetAddress_Private addresses[],
int32_t count); uint32_t count);
/** /**
* @return Returns display name for the network interface with the * @return Returns display name for the network interface with the
* specified <code>index</code>. * specified <code>index</code>.
...@@ -131,7 +135,7 @@ struct PPB_NetworkList_Private_0_2 { ...@@ -131,7 +135,7 @@ struct PPB_NetworkList_Private_0_2 {
struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index); struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index);
/** /**
* @return Returns MTU for the network interface with the specified * @return Returns MTU for the network interface with the specified
* <code>index</code>. * <code>index</code> or 0 if MTU is unknown.
*/ */
uint32_t (*GetMTU)(PP_Resource resource, uint32_t index); uint32_t (*GetMTU)(PP_Resource resource, uint32_t index);
}; };
......
// 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/private/network_list_private.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var.h"
namespace pp {
namespace {
template <> const char* interface_name<PPB_NetworkList_Private>() {
return PPB_NETWORKLIST_PRIVATE_INTERFACE;
}
} // namespace
NetworkListPrivate::NetworkListPrivate(PP_Resource resource)
: Resource(resource) {
}
// static
bool NetworkListPrivate::IsAvailable() {
return has_interface<PPB_NetworkList_Private>();
}
uint32_t NetworkListPrivate::GetCount() {
if (!has_interface<PPB_NetworkList_Private>())
return 0;
return get_interface<PPB_NetworkList_Private>()->GetCount(pp_resource());
}
std::string NetworkListPrivate::GetName(uint32_t index) {
if (!has_interface<PPB_NetworkList_Private>())
return std::string();
Var result(PASS_REF,
get_interface<PPB_NetworkList_Private>()->GetName(
pp_resource(), index));
return result.is_string() ? result.AsString() : std::string();
}
PP_NetworkListType_Private NetworkListPrivate::GetType(uint32_t index) {
if (!has_interface<PPB_NetworkList_Private>())
return PP_NETWORKLIST_ETHERNET;
return get_interface<PPB_NetworkList_Private>()->GetType(
pp_resource(), index);
}
PP_NetworkListState_Private NetworkListPrivate::GetState(uint32_t index) {
if (!has_interface<PPB_NetworkList_Private>())
return PP_NETWORKLIST_DOWN;
return get_interface<PPB_NetworkList_Private>()->GetState(
pp_resource(), index);
}
void NetworkListPrivate::GetIpAddresses(
uint32_t index,
std::vector<PP_NetAddress_Private>* addresses) {
if (!has_interface<PPB_NetworkList_Private>())
return;
// Most netword interfaces don't have more than 3 network
// interfaces.
addresses->resize(3);
int32_t result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses(
pp_resource(), index, &addresses->front(), addresses->size());
if (result < 0) {
addresses->resize(0);
return;
}
if (result <= static_cast<int32_t>(addresses->size())) {
addresses->resize(result);
return;
}
addresses->resize(result);
result = get_interface<PPB_NetworkList_Private>()->GetIpAddresses(
pp_resource(), index, &addresses->front(), addresses->size());
if (result < 0) {
addresses->resize(0);
} else if (result < static_cast<int32_t>(addresses->size())) {
addresses->resize(result);
}
}
std::string NetworkListPrivate::GetDisplayName(uint32_t index) {
if (!has_interface<PPB_NetworkList_Private>())
return std::string();
Var result(PASS_REF,
get_interface<PPB_NetworkList_Private>()->GetDisplayName(
pp_resource(), index));
return result.is_string() ? result.AsString() : std::string();
}
uint32_t NetworkListPrivate::GetMTU(uint32_t index) {
if (!has_interface<PPB_NetworkList_Private>())
return 0;
return get_interface<PPB_NetworkList_Private>()->GetMTU(
pp_resource(), index);
}
} // namespace pp
// 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_PRIVATE_NETWORK_LIST_PRIVATE_H_
#define PPAPI_CPP_PRIVATE_NETWORK_LIST_PRIVATE_H_
#include <string>
#include <vector>
#include "ppapi/c/private/ppb_network_list_private.h"
#include "ppapi/cpp/resource.h"
namespace pp {
class NetworkListPrivate : public Resource {
public:
explicit NetworkListPrivate(PP_Resource resource);
/// Returns true if the required interface is available.
static bool IsAvailable();
/// @return Returns the number of available network interfaces or 0
/// if the list has never been updated.
uint32_t GetCount();
/// @return Returns the name for the network interface with the
/// specified <code>index</code>.
std::string GetName(uint32_t index);
/// @return Returns the type of the network interface with the
/// specified <code>index</code>.
PP_NetworkListType_Private GetType(uint32_t index);
/// @return Returns the current state of the network interface with
/// the specified <code>index</code>.
PP_NetworkListState_Private GetState(uint32_t index);
/// Gets the list of IP addresses for the network interface with the
/// specified <code>index</code> and stores them in
/// <code>addresses</code>.
void GetIpAddresses(uint32_t index,
std::vector<PP_NetAddress_Private>* addresses);
/// @return Returns the display name for the network interface with
/// the specified <code>index</code>.
std::string GetDisplayName(uint32_t index);
/// @return Returns the MTU for the network interface with the
/// specified <code>index</code>.
uint32_t GetMTU(uint32_t index);
};
} // namespace pp
#endif // PPAPI_CPP_PRIVATE_NETWORK_LIST_PRIVATE_H_
// 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/private/network_monitor_private.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module_impl.h"
namespace pp {
namespace {
template <> const char* interface_name<PPB_NetworkMonitor_Private>() {
return PPB_NETWORKMONITOR_PRIVATE_INTERFACE;
}
} // namespace
NetworkMonitorPrivate::NetworkMonitorPrivate(
const InstanceHandle& instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) {
if (has_interface<PPB_NetworkMonitor_Private>()) {
PassRefFromConstructor(get_interface<PPB_NetworkMonitor_Private>()->Create(
instance.pp_instance(), callback, user_data));
}
}
// static
bool NetworkMonitorPrivate::IsAvailable() {
return has_interface<PPB_NetworkMonitor_Private>();
}
} // namespace pp
// 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_PRIVATE_NETWORK_MONITOR_PRIVATE_H_
#define PPAPI_CPP_PRIVATE_NETWORK_MONITOR_PRIVATE_H_
#include "ppapi/c/private/ppb_network_monitor_private.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/instance_handle.h"
namespace pp {
class Instance;
class NetworkMonitorPrivate : public Resource {
public:
NetworkMonitorPrivate(const InstanceHandle& instance,
PPB_NetworkMonitor_Callback callback,
void* user_data);
// Returns true if the required interface is available.
static bool IsAvailable();
};
} // namespace pp
#endif // PPAPI_CPP_PRIVATE_NETWORK_MONITOR_PRIVATE_H_
...@@ -88,6 +88,8 @@ ...@@ -88,6 +88,8 @@
'shared_impl/ppb_instance_shared.cc', 'shared_impl/ppb_instance_shared.cc',
'shared_impl/ppb_instance_shared.h', 'shared_impl/ppb_instance_shared.h',
'shared_impl/ppb_memory_shared.cc', 'shared_impl/ppb_memory_shared.cc',
'shared_impl/ppb_network_list_private_shared.cc',
'shared_impl/ppb_network_list_private_shared.h',
'shared_impl/ppb_opengles2_shared.cc', 'shared_impl/ppb_opengles2_shared.cc',
'shared_impl/ppb_opengles2_shared.h', 'shared_impl/ppb_opengles2_shared.h',
'shared_impl/ppb_resource_array_shared.cc', 'shared_impl/ppb_resource_array_shared.cc',
...@@ -202,6 +204,10 @@ ...@@ -202,6 +204,10 @@
'thunk/ppb_message_loop_api.h', 'thunk/ppb_message_loop_api.h',
'thunk/ppb_messaging_thunk.cc', 'thunk/ppb_messaging_thunk.cc',
'thunk/ppb_mouse_lock_thunk.cc', 'thunk/ppb_mouse_lock_thunk.cc',
'thunk/ppb_network_list_private_api.h',
'thunk/ppb_network_list_private_thunk.cc',
'thunk/ppb_network_monitor_private_api.h',
'thunk/ppb_network_monitor_private_thunk.cc',
'thunk/ppb_pdf_api.h', 'thunk/ppb_pdf_api.h',
'thunk/ppb_resource_array_api.h', 'thunk/ppb_resource_array_api.h',
'thunk/ppb_resource_array_thunk.cc', 'thunk/ppb_resource_array_thunk.cc',
......
...@@ -102,6 +102,8 @@ ...@@ -102,6 +102,8 @@
'c/private/ppb_pdf.h', 'c/private/ppb_pdf.h',
'c/private/ppb_proxy_private.h', 'c/private/ppb_proxy_private.h',
'c/private/ppp_instance_private.h', 'c/private/ppp_instance_private.h',
'c/private/ppb_network_list_private.h',
'c/private/ppb_network_monitor_private.h',
'c/private/ppb_tcp_socket_private.h', 'c/private/ppb_tcp_socket_private.h',
'c/private/ppb_udp_socket_private.h', 'c/private/ppb_udp_socket_private.h',
...@@ -253,6 +255,10 @@ ...@@ -253,6 +255,10 @@
'cpp/private/instance_private.h', 'cpp/private/instance_private.h',
'cpp/private/net_address_private.cc', 'cpp/private/net_address_private.cc',
'cpp/private/net_address_private.h', 'cpp/private/net_address_private.h',
'cpp/private/network_list_private.cc',
'cpp/private/network_list_private.h',
'cpp/private/network_monitor_private.cc',
'cpp/private/network_monitor_private.h',
'cpp/private/tcp_socket_private.cc', 'cpp/private/tcp_socket_private.cc',
'cpp/private/tcp_socket_private.h', 'cpp/private/tcp_socket_private.h',
'cpp/private/udp_socket_private.cc', 'cpp/private/udp_socket_private.cc',
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "ppapi/c/private/ppb_flash_net_connector.h" #include "ppapi/c/private/ppb_flash_net_connector.h"
#include "ppapi/c/private/ppb_flash_tcp_socket.h" #include "ppapi/c/private/ppb_flash_tcp_socket.h"
#include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/c/private/ppb_net_address_private.h"
#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_pdf.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h"
......
...@@ -238,6 +238,14 @@ PP_Resource ResourceCreationProxy::CreateMouseInputEvent( ...@@ -238,6 +238,14 @@ PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
instance, data))->GetReference(); instance, data))->GetReference();
} }
PP_Resource ResourceCreationProxy::CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) {
NOTIMPLEMENTED(); // Not proxied yet.
return 0;
}
PP_Resource ResourceCreationProxy::CreateGraphics3D( PP_Resource ResourceCreationProxy::CreateGraphics3D(
PP_Instance instance, PP_Instance instance,
PP_Resource share_context, PP_Resource share_context,
......
...@@ -101,6 +101,10 @@ class ResourceCreationProxy : public InterfaceProxy, ...@@ -101,6 +101,10 @@ class ResourceCreationProxy : public InterfaceProxy,
const PP_Point* mouse_position, const PP_Point* mouse_position,
int32_t click_count, int32_t click_count,
const PP_Point* mouse_movement) OVERRIDE; const PP_Point* mouse_movement) OVERRIDE;
virtual PP_Resource CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) OVERRIDE;
virtual PP_Resource CreateResourceArray(PP_Instance instance, virtual PP_Resource CreateResourceArray(PP_Instance instance,
const PP_Resource elements[], const PP_Resource elements[],
uint32_t size) OVERRIDE; uint32_t size) OVERRIDE;
......
// 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 <algorithm>
#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/shared_impl/ppb_network_list_private_shared.h"
#include "ppapi/shared_impl/var.h"
namespace ppapi {
PPB_NetworkList_Private_Shared::NetworkInfo::NetworkInfo()
: type(PP_NETWORKLIST_UNKNOWN),
state(PP_NETWORKLIST_DOWN),
mtu(0) {
}
PPB_NetworkList_Private_Shared::NetworkInfo::~NetworkInfo() {
}
PPB_NetworkList_Private_Shared::PPB_NetworkList_Private_Shared(
ResourceObjectType type,
PP_Instance instance,
scoped_ptr<NetworkList> list)
: Resource(type, instance),
list_(list.Pass()) {
}
PPB_NetworkList_Private_Shared::~PPB_NetworkList_Private_Shared() {
}
// static
PP_Resource PPB_NetworkList_Private_Shared::Create(
ResourceObjectType type,
PP_Instance instance,
scoped_ptr<NetworkList> list) {
scoped_refptr<PPB_NetworkList_Private_Shared> object(
new PPB_NetworkList_Private_Shared(type, instance, list.Pass()));
return object->GetReference();
}
::ppapi::thunk::PPB_NetworkList_Private_API*
PPB_NetworkList_Private_Shared::AsPPB_NetworkList_Private_API() {
return this;
}
uint32_t PPB_NetworkList_Private_Shared::GetCount() {
return list_->size();
}
PP_Var PPB_NetworkList_Private_Shared::GetName(uint32_t index) {
if (index >= list_->size())
return PP_MakeUndefined();
return StringVar::StringToPPVar(list_->at(index).name);
}
PP_NetworkListType_Private PPB_NetworkList_Private_Shared::GetType(
uint32_t index) {
if (index >= list_->size())
return PP_NETWORKLIST_UNKNOWN;
return list_->at(index).type;
}
PP_NetworkListState_Private PPB_NetworkList_Private_Shared::GetState(
uint32_t index) {
if (index >= list_->size())
return PP_NETWORKLIST_DOWN;
return list_->at(index).state;
}
int32_t PPB_NetworkList_Private_Shared::GetIpAddresses(
uint32_t index,
struct PP_NetAddress_Private addresses[],
uint32_t count) {
if (index >= list_->size())
return PP_ERROR_FAILED;
count = std::min(
count, static_cast<uint32_t>(list_->at(index).addresses.size()));
memcpy(addresses, &(list_->at(index).addresses[0]),
sizeof(PP_NetAddress_Private) * count);
return list_->at(index).addresses.size();
}
PP_Var PPB_NetworkList_Private_Shared::GetDisplayName(uint32_t index) {
if (index >= list_->size())
return PP_MakeUndefined();
return StringVar::StringToPPVar(list_->at(index).display_name);
}
uint32_t PPB_NetworkList_Private_Shared::GetMTU(uint32_t index) {
if (index >= list_->size())
return 0;
return list_->at(index).mtu;
}
} // namespace thunk
// 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_NETWORK_LIST_PRIVATE_SHARED_H_
#define PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_
#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/thunk/ppb_network_list_private_api.h"
namespace ppapi {
class PPAPI_SHARED_EXPORT PPB_NetworkList_Private_Shared
: public ::ppapi::Resource,
public ::ppapi::thunk::PPB_NetworkList_Private_API {
public:
struct NetworkInfo {
NetworkInfo();
~NetworkInfo();
std::string name;
PP_NetworkListType_Private type;
PP_NetworkListState_Private state;
std::vector<PP_NetAddress_Private> addresses;
std::string display_name;
int mtu;
};
typedef std::vector<NetworkInfo> NetworkList;
static PP_Resource Create(ResourceObjectType type,
PP_Instance instance,
scoped_ptr<NetworkList> list);
virtual ~PPB_NetworkList_Private_Shared();
// Resource override.
virtual ::ppapi::thunk::PPB_NetworkList_Private_API*
AsPPB_NetworkList_Private_API() OVERRIDE;
// PPB_NetworkList_Private_API implementation.
virtual uint32_t GetCount() OVERRIDE;
virtual PP_Var GetName(uint32_t index) OVERRIDE;
virtual PP_NetworkListType_Private GetType(uint32_t index) OVERRIDE;
virtual PP_NetworkListState_Private GetState(uint32_t index) OVERRIDE;
virtual int32_t GetIpAddresses(uint32_t index,
PP_NetAddress_Private addresses[],
uint32_t count) OVERRIDE;
virtual PP_Var GetDisplayName(uint32_t index) OVERRIDE;
virtual uint32_t GetMTU(uint32_t index) OVERRIDE;
private:
PPB_NetworkList_Private_Shared(ResourceObjectType type,
PP_Instance instance,
scoped_ptr<NetworkList> list);
scoped_ptr<NetworkList> list_;
DISALLOW_COPY_AND_ASSIGN(PPB_NetworkList_Private_Shared);
};
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
F(PPB_InputEvent_API) \ F(PPB_InputEvent_API) \
F(PPB_LayerCompositor_API) \ F(PPB_LayerCompositor_API) \
F(PPB_MessageLoop_API) \ F(PPB_MessageLoop_API) \
F(PPB_NetworkList_Private_API) \
F(PPB_NetworkMonitor_Private_API) \
F(PPB_PDFFont_API) \ F(PPB_PDFFont_API) \
F(PPB_ResourceArray_API) \ F(PPB_ResourceArray_API) \
F(PPB_Scrollbar_API) \ F(PPB_Scrollbar_API) \
......
...@@ -35,6 +35,12 @@ PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2, ...@@ -35,6 +35,12 @@ PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3, PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3,
PPB_UDPSocket_Private_0_3) PPB_UDPSocket_Private_0_3)
UNPROXIED_IFACE(PPB_NetworkList_Private, PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2,
PPB_NetworkList_Private_0_2)
UNPROXIED_IFACE(PPB_NetworkMonitor_Private,
PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2,
PPB_NetworkMonitor_Private_0_2)
// Hack to keep font working. The Font 0.6 API is binary compatible with // 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. // BrowserFont 1.0, so just map the string to the same thing.
// TODO(brettw) remove support for the old Font API. // TODO(brettw) remove support for the old Font API.
......
// 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_NETWORK_LIST_PRIVATE_API_H_
#define PPAPI_THUNK_PPB_NETWORK_LIST_PRIVATE_API_H_
#include "ppapi/c/private/ppb_network_list_private.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi {
namespace thunk {
class PPAPI_THUNK_EXPORT PPB_NetworkList_Private_API {
public:
virtual ~PPB_NetworkList_Private_API() {}
virtual uint32_t GetCount() = 0;
virtual PP_Var GetName(uint32_t index) = 0;
virtual PP_NetworkListType_Private GetType(uint32_t index) = 0;
virtual PP_NetworkListState_Private GetState(uint32_t index) = 0;
virtual int32_t GetIpAddresses(uint32_t index,
PP_NetAddress_Private addresses[],
uint32_t count) = 0;
virtual PP_Var GetDisplayName(uint32_t index) = 0;
virtual uint32_t GetMTU(uint32_t index) = 0;
};
} // namespace thunk
} // namespace ppapi
#endif // PPAPI_THUNK_PPB_NETWORK_LIST_PRIVATE_API_H_
// 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/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_network_list_private_api.h"
namespace ppapi {
namespace thunk {
namespace {
typedef EnterResource<PPB_NetworkList_Private_API> EnterNetworkList;
PP_Bool IsNetworkList(PP_Resource resource) {
EnterNetworkList enter(resource, false);
return PP_FromBool(enter.succeeded());
}
uint32_t GetCount(PP_Resource network_list) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return 0;
return enter.object()->GetCount();
}
PP_Var GetName(PP_Resource network_list, uint32_t index) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetName(index);
}
PP_NetworkListType_Private GetType(PP_Resource network_list, uint32_t index) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return PP_NETWORKLIST_UNKNOWN;
return enter.object()->GetType(index);
}
PP_NetworkListState_Private GetState(PP_Resource network_list, uint32_t index) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return PP_NETWORKLIST_DOWN;
return enter.object()->GetState(index);
}
int32_t GetIpAddresses(PP_Resource network_list,
uint32_t index,
struct PP_NetAddress_Private addresses[],
uint32_t count) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return enter.retval();
return enter.object()->GetIpAddresses(index, addresses, count);
}
PP_Var GetDisplayName(PP_Resource network_list, uint32_t index) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return PP_MakeUndefined();
return enter.object()->GetDisplayName(index);
}
uint32_t GetMTU(PP_Resource network_list, uint32_t index) {
EnterNetworkList enter(network_list, true);
if (enter.failed())
return 0;
return enter.object()->GetMTU(index);
}
const PPB_NetworkList_Private g_ppb_network_list_private_thunk = {
&IsNetworkList,
&GetCount,
&GetName,
&GetType,
&GetState,
&GetIpAddresses,
&GetDisplayName,
&GetMTU,
};
} // namespace
const PPB_NetworkList_Private_0_2* GetPPB_NetworkList_Private_0_2_Thunk() {
return &g_ppb_network_list_private_thunk;
}
} // namespace thunk
} // namespace ppapi
// 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_NETWORK_MONITOR_PRIVATE_API_H_
#define PPAPI_THUNK_PPB_NETWORK_MONITOR_PRIVATE_API_H_
#include "ppapi/c/private/ppb_network_monitor_private.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi {
namespace thunk {
class PPAPI_THUNK_EXPORT PPB_NetworkMonitor_Private_API {
public:
virtual ~PPB_NetworkMonitor_Private_API() {}
};
} // namespace thunk
} // namespace ppapi
#endif // PPAPI_THUNK_PPB_NETWORK_MONITOR_PRIVATE_API_H_
// 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/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_network_monitor_private_api.h"
#include "ppapi/thunk/resource_creation_api.h"
namespace ppapi {
namespace thunk {
namespace {
typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor;
PP_Resource Create(PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) {
EnterFunction<ResourceCreationAPI> enter(instance, true);
if (enter.failed())
return 0;
return enter.functions()->CreateNetworkMonitor(instance, callback, user_data);
}
PP_Bool IsNetworkMonitor(PP_Resource resource) {
EnterNetworkMonitor enter(resource, false);
return PP_FromBool(enter.succeeded());
}
const PPB_NetworkMonitor_Private g_ppb_network_monitor_private_thunk = {
&Create,
&IsNetworkMonitor,
};
} // namespace
const PPB_NetworkMonitor_Private_0_2*
GetPPB_NetworkMonitor_Private_0_2_Thunk() {
return &g_ppb_network_monitor_private_thunk;
}
} // namespace thunk
} // namespace ppapi
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/dev/ppb_transport_dev.h" #include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/private/ppb_network_monitor_private.h"
#include "ppapi/shared_impl/api_id.h" #include "ppapi/shared_impl/api_id.h"
struct PP_Flash_Menu; struct PP_Flash_Menu;
...@@ -103,6 +104,10 @@ class ResourceCreationAPI { ...@@ -103,6 +104,10 @@ class ResourceCreationAPI {
const PP_Point* mouse_position, const PP_Point* mouse_position,
int32_t click_count, int32_t click_count,
const PP_Point* mouse_movement) = 0; const PP_Point* mouse_movement) = 0;
virtual PP_Resource CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) = 0;
virtual PP_Resource CreateResourceArray(PP_Instance instance, virtual PP_Resource CreateResourceArray(PP_Instance instance,
const PP_Resource elements[], const PP_Resource elements[],
uint32_t size) = 0; uint32_t size) = 0;
......
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
#include "ppapi/c/private/ppb_flash_tcp_socket.h" #include "ppapi/c/private/ppb_flash_tcp_socket.h"
#include "ppapi/c/private/ppb_gpu_blacklist_private.h" #include "ppapi/c/private/ppb_gpu_blacklist_private.h"
#include "ppapi/c/private/ppb_instance_private.h" #include "ppapi/c/private/ppb_instance_private.h"
#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_pdf.h"
#include "ppapi/c/private/ppb_proxy_private.h" #include "ppapi/c/private/ppb_proxy_private.h"
#include "ppapi/c/private/ppb_tcp_server_socket_private.h" #include "ppapi/c/private/ppb_tcp_server_socket_private.h"
......
...@@ -244,6 +244,14 @@ PP_Resource ResourceCreationImpl::CreateMouseInputEvent( ...@@ -244,6 +244,14 @@ PP_Resource ResourceCreationImpl::CreateMouseInputEvent(
instance, data))->GetReference(); instance, data))->GetReference();
} }
PP_Resource ResourceCreationImpl::CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) {
NOTIMPLEMENTED();
return 0;
}
PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance,
PP_Bool vertical) { PP_Bool vertical) {
return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical));
......
...@@ -88,6 +88,10 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, ...@@ -88,6 +88,10 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase,
const PP_Point* mouse_position, const PP_Point* mouse_position,
int32_t click_count, int32_t click_count,
const PP_Point* mouse_movement) OVERRIDE; const PP_Point* mouse_movement) OVERRIDE;
virtual PP_Resource CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) OVERRIDE;
virtual PP_Resource CreateResourceArray(PP_Instance instance, virtual PP_Resource CreateResourceArray(PP_Instance instance,
const PP_Resource elements[], const PP_Resource elements[],
uint32_t size) OVERRIDE; uint32_t size) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment