Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: ppapi/shared_impl/private/ppb_host_resolver_shared.h

Issue 11411357: PPB_HostResolver_Private is switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/shared_impl/tracked_callback.h"
15 #include "ppapi/thunk/ppb_host_resolver_private_api.h"
16
17 namespace ppapi {
18
19 struct HostPortPair {
20 std::string host;
21 uint16_t port;
22 };
23
24 class PPAPI_SHARED_EXPORT PPB_HostResolver_Shared
25 : public thunk::PPB_HostResolver_Private_API,
26 public Resource {
27 public:
28 // C-tor used in Impl case.
29 explicit PPB_HostResolver_Shared(PP_Instance instance);
30
31 // C-tor used in Proxy case.
32 explicit PPB_HostResolver_Shared(const HostResource& resource);
33
34 virtual ~PPB_HostResolver_Shared();
35
36 // Resource overrides.
37 virtual PPB_HostResolver_Private_API*
38 AsPPB_HostResolver_Private_API() OVERRIDE;
39
40 // PPB_HostResolver_Private_API implementation.
41 virtual int32_t Resolve(const char* host,
42 uint16_t port,
43 const PP_HostResolver_Private_Hint* hint,
44 scoped_refptr<TrackedCallback> callback) OVERRIDE;
45 virtual PP_Var GetCanonicalName() OVERRIDE;
46 virtual uint32_t GetSize() OVERRIDE;
47 virtual bool GetNetAddress(uint32_t index,
48 PP_NetAddress_Private* address) OVERRIDE;
49
50 void OnResolveCompleted(
51 bool succeeded,
52 const std::string& canonical_name,
53 const std::vector<PP_NetAddress_Private>& net_address_list);
54
55 // Send functions that need to be implemented differently for the
56 // proxied and non-proxied derived classes.
57 virtual void SendResolve(const HostPortPair& host_port,
58 const PP_HostResolver_Private_Hint* hint) = 0;
59
60 protected:
61 static uint32 GenerateHostResolverID();
62 bool ResolveInProgress() const;
63
64 const uint32 host_resolver_id_;
65
66 scoped_refptr<TrackedCallback> resolve_callback_;
67
68 std::string canonical_name_;
69 std::vector<PP_NetAddress_Private> net_address_list_;
70
71 DISALLOW_COPY_AND_ASSIGN(PPB_HostResolver_Shared);
72 };
73
74 } // namespace ppapi
75
76 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.cc ('k') | ppapi/shared_impl/private/ppb_host_resolver_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698