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

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

Issue 9455092: HostResolver is exposed to plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed PPB_HostResolver_Private: |addr| arg in GetNetAddress can't be NULL. Created 8 years, 9 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
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 "base/memory/scoped_ptr.h"
14 #include "ppapi/shared_impl/resource.h"
15 #include "ppapi/shared_impl/tracked_callback.h"
16 #include "ppapi/thunk/ppb_host_resolver_private_api.h"
17
18 struct addrinfo;
19
20 namespace ppapi {
21
22 struct HostPortPair {
23 std::string host;
24 uint16_t port;
25 };
26
27 typedef std::vector<PP_NetAddress_Private> NetworkList;
yzshen1 2012/03/06 08:07:46 Now that it is simply a list of PP_NetAddress_Priv
ygorshenin1 2012/03/06 10:38:18 Done.
28
29 PPAPI_SHARED_EXPORT NetworkList*
30 CreateNetworkListFromAddrInfo(const addrinfo* ai);
31
32 class PPAPI_SHARED_EXPORT PPB_HostResolver_Shared
33 : public thunk::PPB_HostResolver_Private_API,
34 public Resource {
35 public:
36 // C-tor used in Impl case.
37 explicit PPB_HostResolver_Shared(PP_Instance instance);
38
39 // C-tor used in Proxy case.
40 explicit PPB_HostResolver_Shared(const HostResource& resource);
41
42 virtual ~PPB_HostResolver_Shared();
43
44 // Resource overrides.
45 virtual PPB_HostResolver_Private_API*
46 AsPPB_HostResolver_Private_API() OVERRIDE;
47
48 // PPB_HostResolver_Private_API implementation.
49 virtual int32_t Resolve(const char* host,
50 uint16_t port,
51 const PP_HostResolver_Private_Hint* hint,
52 PP_CompletionCallback callback) OVERRIDE;
53 virtual PP_Var GetCanonicalName() OVERRIDE;
54 virtual uint32_t GetSize() OVERRIDE;
55 virtual bool GetNetAddress(uint32_t index,
56 PP_NetAddress_Private* address) OVERRIDE;
57
58 void OnResolveCompleted(bool succeeded,
59 const std::string& canonical_name,
60 const NetworkList& network_list);
61
62 // Send functions that need to be implemented differently for the
63 // proxied and non-proxied derived classes.
64 virtual void SendResolve(const HostPortPair& host_port,
65 const PP_HostResolver_Private_Hint* hint) = 0;
66
67 protected:
68 static uint32 GenerateHostResolverID();
69 bool ResolveInProgress() const;
70
71 const uint32 host_resolver_id_;
72
73 scoped_refptr<TrackedCallback> resolve_callback_;
74
75 std::string canonical_name_;
76 NetworkList network_list_;
77
78 DISALLOW_COPY_AND_ASSIGN(PPB_HostResolver_Shared);
79 };
80
81 } // namespace ppapi
82
83 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_HOST_RESOLVER_SHARED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698