OLD | NEW |
---|---|
(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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOST_H _ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOST_H _ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/callback.h" | |
13 #include "base/compiler_specific.h" | |
14 #include "base/memory/weak_ptr.h" | |
15 #include "content/common/content_export.h" | |
16 #include "ppapi/host/host_message_context.h" | |
17 #include "ppapi/host/resource_host.h" | |
18 | |
19 struct PP_HostResolver_Private_Hint; | |
20 struct PP_NetAddress_Private; | |
21 | |
22 namespace net { | |
23 class AddressList; | |
24 class HostResolver; | |
25 } | |
26 | |
27 namespace ppapi { | |
28 struct HostPortPair; | |
29 } | |
30 | |
31 namespace content { | |
32 | |
33 class BrowserPpapiHostImpl; | |
34 class ResourceContext; | |
35 struct SocketPermissionRequest; | |
36 | |
37 class CONTENT_EXPORT PepperHostResolverPrivateHost | |
38 : public ppapi::host::ResourceHost { | |
39 public: | |
40 PepperHostResolverPrivateHost( | |
41 BrowserPpapiHostImpl* host, | |
42 PP_Instance instance, | |
43 PP_Resource resource); | |
44 virtual ~PepperHostResolverPrivateHost(); | |
45 | |
46 // ppapi::host::ResourceHost implementation. | |
47 virtual int32_t OnResourceMessageReceived( | |
48 const IPC::Message& msg, | |
49 ppapi::host::HostMessageContext* context) OVERRIDE; | |
50 | |
51 private: | |
yzshen1
2013/01/24 18:45:03
nit: wrong indent.
ygorshenin1
2013/02/05 12:45:31
Done.
| |
52 typedef ppapi::host::ReplyMessageContext ReplyMessageContext; | |
yzshen1
2013/01/24 18:45:03
You could use a 'using' in the .cc file instead of
ygorshenin1
2013/02/05 12:45:31
Done.
| |
53 typedef base::Callback<void(bool allowed)> PermissionCheckCallback; | |
54 typedef std::vector<PP_NetAddress_Private> NetAddressList; | |
55 | |
56 void SetHostResolver(ResourceContext* resource_context); | |
yzshen1
2013/01/24 18:45:03
It would be good to comment on which thread each m
ygorshenin1
2013/02/05 12:45:31
Done.
| |
57 | |
58 int32_t OnMsgResolve(const ppapi::host::HostMessageContext* context, | |
59 const ppapi::HostPortPair& host_port, | |
60 const PP_HostResolver_Private_Hint& hint); | |
61 void OnResolve(const ReplyMessageContext& context, | |
yzshen1
2013/01/24 18:45:03
Can you please rename OnResolve() and DoResolve()?
ygorshenin1
2013/02/05 12:45:31
Done.
| |
62 const ppapi::HostPortPair& host_port, | |
63 const PP_HostResolver_Private_Hint& hint); | |
64 void DoResolve(const ReplyMessageContext& context, | |
65 const ppapi::HostPortPair& host_port, | |
66 const PP_HostResolver_Private_Hint& hint, | |
67 bool allowed); | |
68 void OnLookupFinished(int result, | |
69 const net::AddressList& addresses, | |
70 const ReplyMessageContext& bound_info); | |
71 void SendResolveReply(bool succeeded, | |
72 const std::string& canonical_name, | |
73 const NetAddressList& net_address_list, | |
74 const ReplyMessageContext& context); | |
75 void SendResolveError(const ReplyMessageContext& context); | |
76 | |
77 void CheckSocketPermissionsAndReply(const SocketPermissionRequest& params, | |
78 const PermissionCheckCallback& callback); | |
79 | |
80 net::HostResolver* host_resolver() const { return host_resolver_; } | |
yzshen1
2013/01/24 18:45:03
I don't see why we need these two private accessor
ygorshenin1
2013/02/05 12:45:31
Done.
| |
81 | |
82 bool host_resolver_is_ready() const { return host_resolver_is_ready_; } | |
83 | |
84 BrowserPpapiHostImpl* host_; | |
85 net::HostResolver* host_resolver_; | |
86 bool host_resolver_is_ready_; | |
87 | |
88 base::WeakPtrFactory<PepperHostResolverPrivateHost> weak_factory_; | |
89 | |
90 DISALLOW_COPY_AND_ASSIGN(PepperHostResolverPrivateHost); | |
91 }; | |
92 | |
93 } // namespace content | |
94 | |
95 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOS T_H_ | |
OLD | NEW |