| Index: ppapi/shared_impl/private/ppb_host_resolver_shared.h
|
| diff --git a/ppapi/shared_impl/private/ppb_host_resolver_shared.h b/ppapi/shared_impl/private/ppb_host_resolver_shared.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..259147aa3293ef4fcd5c222d11bd7349b92ce565
|
| --- /dev/null
|
| +++ b/ppapi/shared_impl/private/ppb_host_resolver_shared.h
|
| @@ -0,0 +1,86 @@
|
| +// 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_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
|
| +#define PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "ppapi/shared_impl/resource.h"
|
| +#include "ppapi/shared_impl/tracked_callback.h"
|
| +#include "ppapi/thunk/ppb_host_resolver_private_api.h"
|
| +
|
| +struct addrinfo;
|
| +
|
| +namespace ppapi {
|
| +
|
| +struct NameAndAddressPair {
|
| + std::string canonical_name;
|
| + PP_NetAddress_Private address;
|
| +};
|
| +
|
| +struct HostPortPair {
|
| + std::string host;
|
| + uint16_t port;
|
| +};
|
| +
|
| +typedef std::vector<NameAndAddressPair> NetworkList;
|
| +
|
| +PPAPI_SHARED_EXPORT NetworkList*
|
| + CreateNetworkListFromAddrInfo(const addrinfo* ai);
|
| +
|
| +class PPAPI_SHARED_EXPORT PPB_HostResolver_Shared
|
| + : public thunk::PPB_HostResolver_Private_API,
|
| + public Resource {
|
| + public:
|
| + // C-tor used in Impl case.
|
| + explicit PPB_HostResolver_Shared(PP_Instance instance);
|
| +
|
| + // C-tor used in Proxy case.
|
| + explicit PPB_HostResolver_Shared(const HostResource& resource);
|
| +
|
| + virtual ~PPB_HostResolver_Shared();
|
| +
|
| + // Resource overrides.
|
| + virtual PPB_HostResolver_Private_API*
|
| + AsPPB_HostResolver_Private_API() OVERRIDE;
|
| +
|
| + // PPB_HostResolver_Private_API implementation.
|
| + virtual int32_t Resolve(const char* host,
|
| + uint16_t port,
|
| + const PP_HostResolver_Private_Hint* hint,
|
| + PP_CompletionCallback callback) OVERRIDE;
|
| + virtual uint32_t GetSize() OVERRIDE;
|
| + virtual bool GetItem(uint32_t index,
|
| + PP_Var* canonical_name,
|
| + PP_NetAddress_Private* address) OVERRIDE;
|
| +
|
| + void OnResolveCompleted(bool succeeded,
|
| + const NetworkList& network_list);
|
| +
|
| + // Send functions that need to be implemented differently for the
|
| + // proxied and non-proxied derived classes.
|
| + virtual void SendResolve(const HostPortPair& host_port,
|
| + const PP_HostResolver_Private_Hint* hint) = 0;
|
| +
|
| + protected:
|
| + static uint32 GenerateHostResolverID();
|
| + bool ResolveInProgress() const;
|
| +
|
| + const uint32 host_resolver_id_;
|
| +
|
| + scoped_refptr<TrackedCallback> resolve_callback_;
|
| +
|
| + NetworkList network_list_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PPB_HostResolver_Shared);
|
| +};
|
| +
|
| +} // namespace ppapi
|
| +
|
| +#endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
|
|
|