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 ~NetAddressResource() override
;
33 // PluginResource implementation.
34 thunk::PPB_NetAddress_API
* AsPPB_NetAddress_API() override
;
36 // PPB_NetAddress_API implementation.
37 PP_NetAddress_Family
GetFamily() override
;
38 PP_Var
DescribeAsString(PP_Bool include_port
) override
;
39 PP_Bool
DescribeAsIPv4Address(PP_NetAddress_IPv4
* ipv4_addr
) override
;
40 PP_Bool
DescribeAsIPv6Address(PP_NetAddress_IPv6
* ipv6_addr
) override
;
41 const PP_NetAddress_Private
& GetNetAddressPrivate() override
;
44 // TODO(yzshen): Refactor the code so that PPB_NetAddress resource doesn't
45 // use PP_NetAddress_Private as storage type.
46 PP_NetAddress_Private address_
;
48 DISALLOW_COPY_AND_ASSIGN(NetAddressResource
);
54 #endif // PPAPI_PROXY_NET_ADDRESS_RESOURCE_H_