summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/private
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/cpp/private')
-rw-r--r--ppapi/cpp/private/network_list_private.cc107
-rw-r--r--ppapi/cpp/private/network_list_private.h56
-rw-r--r--ppapi/cpp/private/network_monitor_private.cc35
-rw-r--r--ppapi/cpp/private/network_monitor_private.h28
4 files changed, 0 insertions, 226 deletions
diff --git a/ppapi/cpp/private/network_list_private.cc b/ppapi/cpp/private/network_list_private.cc
deleted file mode 100644
index d08410e..0000000
--- a/ppapi/cpp/private/network_list_private.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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
diff --git a/ppapi/cpp/private/network_list_private.h b/ppapi/cpp/private/network_list_private.h
deleted file mode 100644
index 223941d1..0000000
--- a/ppapi/cpp/private/network_list_private.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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_
diff --git a/ppapi/cpp/private/network_monitor_private.cc b/ppapi/cpp/private/network_monitor_private.cc
deleted file mode 100644
index 2f931ea..0000000
--- a/ppapi/cpp/private/network_monitor_private.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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
diff --git a/ppapi/cpp/private/network_monitor_private.h b/ppapi/cpp/private/network_monitor_private.h
deleted file mode 100644
index 693bbcd..0000000
--- a/ppapi/cpp/private/network_monitor_private.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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_