1 // Copyright 2013 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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_MESSAGE_FILTER_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "content/common/content_export.h"
14 #include "content/public/common/process_type.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/host/resource_message_filter.h"
18 struct PP_HostResolver_Private_Hint;
19 struct PP_NetAddress_Private;
29 struct HostMessageContext;
35 class BrowserPpapiHostImpl;
36 class ResourceContext;
38 class CONTENT_EXPORT PepperHostResolverMessageFilter
39 : public ppapi::host::ResourceMessageFilter {
41 PepperHostResolverMessageFilter(BrowserPpapiHostImpl* host,
46 ~PepperHostResolverMessageFilter() override;
49 typedef std::vector<PP_NetAddress_Private> NetAddressList;
51 // ppapi::host::ResourceMessageFilter overrides.
52 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
53 const IPC::Message& message) override;
54 int32_t OnResourceMessageReceived(
55 const IPC::Message& msg,
56 ppapi::host::HostMessageContext* context) override;
58 int32_t OnMsgResolve(const ppapi::host::HostMessageContext* context,
59 const ppapi::HostPortPair& host_port,
60 const PP_HostResolver_Private_Hint& hint);
62 // Backend for OnMsgResolve(). Delegates host resolution to the
63 // Browser's HostResolver. Must be called on the IO thread.
64 void DoResolve(const ppapi::host::ReplyMessageContext& context,
65 const ppapi::HostPortPair& host_port,
66 const PP_HostResolver_Private_Hint& hint,
67 ResourceContext* resource_context);
69 void OnLookupFinished(int net_result,
70 const net::AddressList& addresses,
71 const ppapi::host::ReplyMessageContext& bound_info);
72 void SendResolveReply(int32_t result,
73 const std::string& canonical_name,
74 const NetAddressList& net_address_list,
75 const ppapi::host::ReplyMessageContext& context);
76 void SendResolveError(int32_t error,
77 const ppapi::host::ReplyMessageContext& context);
79 bool external_plugin_;
81 int render_process_id_;
84 DISALLOW_COPY_AND_ASSIGN(PepperHostResolverMessageFilter);
87 } // namespace content
89 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_MESSAGE_FILTER_H_