1 // Copyright 2013 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.
5 #ifndef PPAPI_PROXY_NET_ADDRESS_RESOURCE_H_
6 #define PPAPI_PROXY_NET_ADDRESS_RESOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ppapi/c/private/ppb_net_address_private.h"
11 #include "ppapi/proxy/plugin_resource.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/thunk/ppb_net_address_api.h"
18 class PPAPI_PROXY_EXPORT NetAddressResource
: public PluginResource
,
19 public thunk::PPB_NetAddress_API
{
21 NetAddressResource(Connection connection
,
23 const PP_NetAddress_IPv4
& ipv4_addr
);
24 NetAddressResource(Connection connection
,
26 const PP_NetAddress_IPv6
& ipv6_addr
);
27 NetAddressResource(Connection connection
,
29 const PP_NetAddress_Private
& private_addr
);
31 virtual ~NetAddressResource();
33 // PluginResource implementation.
34 virtual thunk::PPB_NetAddress_API
* AsPPB_NetAddress_API() override
;
36 // PPB_NetAddress_API implementation.
37 virtual PP_NetAddress_Family
GetFamily() override
;
38 virtual PP_Var
DescribeAsString(PP_Bool include_port
) override
;
39 virtual PP_Bool
DescribeAsIPv4Address(
40 PP_NetAddress_IPv4
* ipv4_addr
) override
;
41 virtual PP_Bool
DescribeAsIPv6Address(
42 PP_NetAddress_IPv6
* ipv6_addr
) override
;
43 virtual const PP_NetAddress_Private
& GetNetAddressPrivate() override
;
46 // TODO(yzshen): Refactor the code so that PPB_NetAddress resource doesn't
47 // use PP_NetAddress_Private as storage type.
48 PP_NetAddress_Private address_
;
50 DISALLOW_COPY_AND_ASSIGN(NetAddressResource
);
56 #endif // PPAPI_PROXY_NET_ADDRESS_RESOURCE_H_