Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: trunk/src/ppapi/proxy/network_list_resource.cc

Issue 23463037: Revert 223482 "Simplify PPB_NetworkMonitor proxy." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/ppapi/proxy/network_list_resource.h ('k') | trunk/src/ppapi/proxy/network_monitor_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ppapi/proxy/network_list_resource.cc
===================================================================
--- trunk/src/ppapi/proxy/network_list_resource.cc (revision 223483)
+++ trunk/src/ppapi/proxy/network_list_resource.cc (working copy)
@@ -1,89 +0,0 @@
-// Copyright 2013 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/network_list_resource.h"
-
-#include <algorithm>
-
-#include "base/logging.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/array_writer.h"
-#include "ppapi/shared_impl/var.h"
-#include "ppapi/thunk/enter.h"
-
-namespace ppapi {
-namespace proxy {
-
-NetworkListResource::NetworkListResource(PP_Instance instance,
- const SerializedNetworkList& list)
- : Resource(OBJECT_IS_PROXY, instance),
- list_(list) {
-}
-
-NetworkListResource::~NetworkListResource() {}
-
-thunk::PPB_NetworkList_API* NetworkListResource::AsPPB_NetworkList_API() {
- return this;
-}
-
-uint32_t NetworkListResource::GetCount() {
- return static_cast<uint32_t>(list_.size());
-}
-
-PP_Var NetworkListResource::GetName(uint32_t index) {
- if (index >= list_.size())
- return PP_MakeUndefined();
- return StringVar::StringToPPVar(list_.at(index).name);
-}
-
-PP_NetworkListType_Private NetworkListResource::GetType(uint32_t index) {
- if (index >= list_.size())
- return PP_NETWORKLIST_UNKNOWN;
- return list_.at(index).type;
-}
-
-PP_NetworkListState_Private NetworkListResource::GetState(uint32_t index) {
- if (index >= list_.size())
- return PP_NETWORKLIST_DOWN;
- return list_.at(index).state;
-}
-
-int32_t NetworkListResource::GetIpAddresses(uint32_t index,
- const PP_ArrayOutput& output) {
- ArrayWriter writer(output);
- if (index >= list_.size() || !writer.is_valid())
- return PP_ERROR_BADARGUMENT;
-
- thunk::EnterResourceCreationNoLock enter(pp_instance());
- if (enter.failed())
- return PP_ERROR_FAILED;
-
- const std::vector<PP_NetAddress_Private>& addresses =
- list_.at(index).addresses;
- std::vector<PP_Resource> addr_resources;
- for (size_t i = 0; i < addresses.size(); ++i) {
- addr_resources.push_back(
- enter.functions()->CreateNetAddressFromNetAddressPrivate(
- pp_instance(), addresses[i]));
- }
- if (!writer.StoreResourceVector(addr_resources))
- return PP_ERROR_FAILED;
-
- return PP_OK;
-}
-
-PP_Var NetworkListResource::GetDisplayName(uint32_t index) {
- if (index >= list_.size())
- return PP_MakeUndefined();
- return StringVar::StringToPPVar(list_.at(index).display_name);
-}
-
-uint32_t NetworkListResource::GetMTU(uint32_t index) {
- if (index >= list_.size())
- return 0;
- return list_.at(index).mtu;
-}
-
-} // namespace proxy
-} // namespace thunk
« no previous file with comments | « trunk/src/ppapi/proxy/network_list_resource.h ('k') | trunk/src/ppapi/proxy/network_monitor_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698