Chromium Code Reviews| 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..e5710d2592aab4daab3fc0d4936a322d21620124 |
| --- /dev/null |
| +++ b/ppapi/shared_impl/private/ppb_host_resolver_shared.h |
| @@ -0,0 +1,71 @@ |
| +// 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/private/network_list.h" |
| +#include "ppapi/shared_impl/resource.h" |
| +#include "ppapi/shared_impl/tracked_callback.h" |
| +#include "ppapi/thunk/ppb_host_resolver_private_api.h" |
| + |
| +namespace ppapi { |
| + |
| +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 std::string& host, |
| + uint16_t port, |
| + const PP_HostResolver_Private_Hint* hint) = 0; |
| + |
| + protected: |
| + static uint32 GenerateHostResolverID(); |
| + |
| + const uint32 host_resolver_id_; |
| + |
| + bool resolve_in_progress_; |
|
yzshen1
2012/02/28 08:29:00
It seems you don't need resolve_in_progress_: Trac
ygorshenin1
2012/02/28 12:09:47
Done.
|
| + 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_ |