- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / proxy / host_resolver_private_resource.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/proxy/host_resolver_private_resource.h"
6
7 #include "ppapi/proxy/net_address_resource.h"
8 #include "ppapi/shared_impl/tracked_callback.h"
9
10 namespace ppapi {
11 namespace proxy {
12
13 HostResolverPrivateResource::HostResolverPrivateResource(Connection connection,
14                                                          PP_Instance instance)
15     : HostResolverResourceBase(connection, instance, true) {
16 }
17
18 HostResolverPrivateResource::~HostResolverPrivateResource() {
19 }
20
21 thunk::PPB_HostResolver_Private_API*
22 HostResolverPrivateResource::AsPPB_HostResolver_Private_API() {
23   return this;
24 }
25
26 int32_t HostResolverPrivateResource::Resolve(
27     const char* host,
28     uint16_t port,
29     const PP_HostResolver_Private_Hint* hint,
30     scoped_refptr<TrackedCallback> callback) {
31   return ResolveImpl(host, port, hint, callback);
32 }
33
34 PP_Var HostResolverPrivateResource::GetCanonicalName() {
35   return GetCanonicalNameImpl();
36 }
37
38 uint32_t HostResolverPrivateResource::GetSize() {
39   return GetSizeImpl();
40 }
41
42 bool HostResolverPrivateResource::GetNetAddress(
43     uint32_t index,
44     PP_NetAddress_Private* address) {
45   if (!address)
46     return false;
47
48   scoped_refptr<NetAddressResource> addr_resource = GetNetAddressImpl(index);
49   if (!addr_resource.get())
50     return false;
51
52   *address = addr_resource->GetNetAddressPrivate();
53   return true;
54 }
55
56 }  // namespace proxy
57 }  // namespace ppapi