Chromium Code Reviews| Index: content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.h |
| diff --git a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.h b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.h |
| similarity index 73% |
| rename from content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.h |
| rename to content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.h |
| index 90f433f133cb5e5a5ec2fe9904101d550626f1ad..50d57eb1df618cca909639aea80ba2a45f73ae50 100644 |
| --- a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.h |
| +++ b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.h |
| @@ -1,9 +1,9 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2013 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_UDP_SOCKET_PRIVATE_MESSAGE_FILTER_H_ |
| -#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_PRIVATE_MESSAGE_FILTER_H_ |
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
| #include <string> |
| @@ -16,12 +16,17 @@ |
| #include "content/public/common/process_type.h" |
| #include "net/base/completion_callback.h" |
| #include "net/base/ip_endpoint.h" |
| +#include "ppapi/c/dev/ppb_udp_socket_dev.h" |
| #include "ppapi/c/pp_instance.h" |
| #include "ppapi/c/pp_stdint.h" |
| #include "ppapi/host/resource_message_filter.h" |
| struct PP_NetAddress_Private; |
| +namespace base { |
| +class ListValue; |
| +} |
| + |
| namespace net { |
| class IOBuffer; |
| class IOBufferWithSize; |
| @@ -39,14 +44,15 @@ namespace content { |
| class BrowserPpapiHostImpl; |
| struct SocketPermissionRequest; |
| -class CONTENT_EXPORT PepperUDPSocketPrivateMessageFilter |
| +class CONTENT_EXPORT PepperUDPSocketMessageFilter |
| : public ppapi::host::ResourceMessageFilter { |
| public: |
| - PepperUDPSocketPrivateMessageFilter(BrowserPpapiHostImpl* host, |
| - PP_Instance instance); |
| + PepperUDPSocketMessageFilter(BrowserPpapiHostImpl* host, |
| + PP_Instance instance, |
| + bool private_api); |
| protected: |
| - virtual ~PepperUDPSocketPrivateMessageFilter(); |
| + virtual ~PepperUDPSocketMessageFilter(); |
| private: |
| // ppapi::host::ResourceMessageFilter overrides. |
| @@ -56,10 +62,10 @@ class CONTENT_EXPORT PepperUDPSocketPrivateMessageFilter |
| const IPC::Message& msg, |
| ppapi::host::HostMessageContext* context) OVERRIDE; |
| - int32_t OnMsgSetBoolSocketFeature( |
| + int32_t OnMsgSetOption( |
| const ppapi::host::HostMessageContext* context, |
| - int32_t name, |
| - bool value); |
| + PP_UDPSocket_Option_Dev name, |
| + const base::ListValue& list_value); |
| int32_t OnMsgBind(const ppapi::host::HostMessageContext* context, |
| const PP_NetAddress_Private& addr); |
| int32_t OnMsgRecvFrom(const ppapi::host::HostMessageContext* context, |
| @@ -77,9 +83,9 @@ class CONTENT_EXPORT PepperUDPSocketPrivateMessageFilter |
| void Close(); |
| void OnRecvFromCompleted(const ppapi::host::ReplyMessageContext& context, |
| - int32_t result); |
| + int net_result); |
| void OnSendToCompleted(const ppapi::host::ReplyMessageContext& context, |
| - int32_t result); |
| + int net_result); |
| void SendBindReply(const ppapi::host::ReplyMessageContext& context, |
| int32_t result, |
| @@ -99,8 +105,19 @@ class CONTENT_EXPORT PepperUDPSocketPrivateMessageFilter |
| void SendSendToError(const ppapi::host::ReplyMessageContext& context, |
| int32_t result); |
| - bool allow_address_reuse_; |
| - bool allow_broadcast_; |
| + // We may receive requests to set options before the underlying socket is |
| + // created. In that case, this structure stores the option requests so that |
| + // they can be applied when the socket is created. |
| + struct OptionData { |
| + OptionData(); |
| + ~OptionData(); |
| + |
| + void Reset(); |
| + |
| + bool allow_address_reuse; |
| + bool allow_broadcast; |
| + }; |
| + OptionData option_data_; |
|
bbudge
2013/06/18 01:15:09
It seems like this struct isn't needed anymore. Do
yzshen1
2013/06/18 05:21:18
Done.
|
| scoped_ptr<net::UDPServerSocket> socket_; |
| bool closed_; |
| @@ -111,12 +128,14 @@ class CONTENT_EXPORT PepperUDPSocketPrivateMessageFilter |
| net::IPEndPoint recvfrom_address_; |
| bool external_plugin_; |
| + bool private_api_; |
| + |
| int render_process_id_; |
| int render_view_id_; |
| - DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketPrivateMessageFilter); |
| + DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); |
| }; |
| } // namespace content |
| -#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_PRIVATE_MESSAGE_FILTER_H_ |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |