Chromium Code Reviews| Index: content/browser/renderer_host/pepper_tcp_server_socket.h |
| diff --git a/content/browser/renderer_host/pepper_tcp_server_socket.h b/content/browser/renderer_host/pepper_tcp_server_socket.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d3ee049187ed3cb31f12d07bf2382362895cfb35 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/pepper_tcp_server_socket.h |
| @@ -0,0 +1,76 @@ |
| +// 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_TCP_SERVER_SOCKET_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +class PepperMessageFilter; |
| +struct PP_NetAddress_Private; |
| + |
| +namespace net { |
| +class ServerSocket; |
| +class StreamSocket; |
| +} |
| + |
| +using base::Callback; |
|
yzshen1
2012/02/09 02:31:50
Don't use 'using' in header files.
ygorshenin1
2012/02/09 15:00:10
Done.
|
| +using net::StreamSocket; |
| + |
| +// PepperTCPSocket is used by PepperMessageFilter to handle requests |
| +// from the Pepper TCP server socket API |
| +// (PPB_TCPServerSocket_Private). |
| +class PepperTCPServerSocket { |
| + public: |
| + typedef Callback<void(int32, |
| + uint32, |
| + uint32, |
| + StreamSocket*, |
| + PP_NetAddress_Private, |
| + PP_NetAddress_Private)> AcceptCallback; |
| + |
| + PepperTCPServerSocket(PepperMessageFilter* manager, |
| + int32 routing_id, |
| + uint32 plugin_dispatcher_id, |
| + uint32 socket_id); |
| + ~PepperTCPServerSocket(); |
| + |
| + void SetAcceptCallback(const AcceptCallback& accept_callback); |
| + |
| + void Listen(const PP_NetAddress_Private& addr, int32 backlog); |
| + void Accept(); |
| + |
| + private: |
| + enum State { |
| + BEFORE_LISTENING, |
| + LISTEN_IN_PROGRESS, |
| + LISTENING, |
| + ACCEPT_IN_PROGRESS, |
| + }; |
| + |
| + void SendListenACKError(); |
| + void SendAcceptACKError(); |
| + |
| + void OnListenCompleted(int result); |
| + void OnAcceptCompleted(int result); |
| + |
| + PepperMessageFilter* manager_; |
| + int32 routing_id_; |
| + uint32 plugin_dispatcher_id_; |
| + uint32 socket_id_; |
| + |
| + State state_; |
| + |
| + scoped_ptr<net::ServerSocket> socket_; |
| + scoped_ptr<net::StreamSocket> socket_buffer_; |
| + |
| + AcceptCallback accept_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket); |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |