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

Unified Diff: content/browser/renderer_host/pepper/pepper_host_resolver_private_host.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: s/SendReply/SendResolveReply, s/SendError/SendResolveError Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/pepper/pepper_host_resolver_private_host.h
diff --git a/content/browser/renderer_host/pepper/pepper_host_resolver_private_host.h b/content/browser/renderer_host/pepper/pepper_host_resolver_private_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..772baeb48d70e5dea14305a35282471ff4a9fe55
--- /dev/null
+++ b/content/browser/renderer_host/pepper/pepper_host_resolver_private_host.h
@@ -0,0 +1,95 @@
+// 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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOST_H_
+#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
+#include "content/common/content_export.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/resource_host.h"
+
+struct PP_HostResolver_Private_Hint;
+struct PP_NetAddress_Private;
+
+namespace net {
+class AddressList;
+class HostResolver;
+}
+
+namespace ppapi {
+struct HostPortPair;
+}
+
+namespace content {
+
+class BrowserPpapiHostImpl;
+class ResourceContext;
+struct SocketPermissionRequest;
+
+class CONTENT_EXPORT PepperHostResolverPrivateHost
+ : public ppapi::host::ResourceHost {
+ public:
+ PepperHostResolverPrivateHost(
+ BrowserPpapiHostImpl* host,
+ PP_Instance instance,
+ PP_Resource resource);
+ virtual ~PepperHostResolverPrivateHost();
+
+ // ppapi::host::ResourceHost implementation.
+ virtual int32_t OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) OVERRIDE;
+
+private:
yzshen1 2013/01/24 18:45:03 nit: wrong indent.
ygorshenin1 2013/02/05 12:45:31 Done.
+ 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.
+ typedef base::Callback<void(bool allowed)> PermissionCheckCallback;
+ typedef std::vector<PP_NetAddress_Private> NetAddressList;
+
+ 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.
+
+ int32_t OnMsgResolve(const ppapi::host::HostMessageContext* context,
+ const ppapi::HostPortPair& host_port,
+ const PP_HostResolver_Private_Hint& hint);
+ 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.
+ const ppapi::HostPortPair& host_port,
+ const PP_HostResolver_Private_Hint& hint);
+ void DoResolve(const ReplyMessageContext& context,
+ const ppapi::HostPortPair& host_port,
+ const PP_HostResolver_Private_Hint& hint,
+ bool allowed);
+ void OnLookupFinished(int result,
+ const net::AddressList& addresses,
+ const ReplyMessageContext& bound_info);
+ void SendResolveReply(bool succeeded,
+ const std::string& canonical_name,
+ const NetAddressList& net_address_list,
+ const ReplyMessageContext& context);
+ void SendResolveError(const ReplyMessageContext& context);
+
+ void CheckSocketPermissionsAndReply(const SocketPermissionRequest& params,
+ const PermissionCheckCallback& callback);
+
+ 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.
+
+ bool host_resolver_is_ready() const { return host_resolver_is_ready_; }
+
+ BrowserPpapiHostImpl* host_;
+ net::HostResolver* host_resolver_;
+ bool host_resolver_is_ready_;
+
+ base::WeakPtrFactory<PepperHostResolverPrivateHost> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperHostResolverPrivateHost);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_HOST_RESOLVER_PRIVATE_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698