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..bac65bfcc45e7e63bc98f2a3d1f6c84858b87b49 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/pepper_tcp_server_socket.h |
| @@ -0,0 +1,63 @@ |
| +// 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/memory/scoped_ptr.h" |
| + |
| +class PepperMessageFilter; |
| +struct PP_NetAddress_Private; |
| + |
| +namespace net { |
| +class ServerSocket; |
| +class StreamSocket; |
| +} |
| + |
| +using net::StreamSocket; |
|
yzshen1
2012/02/10 22:40:15
You missed this one.
ygorshenin1
2012/02/13 14:59:46
Done.
|
| + |
| +// PepperTCPSocket is used by PepperMessageFilter to handle requests |
| +// from the Pepper TCP server socket API |
| +// (PPB_TCPServerSocket_Private). |
| +class PepperTCPServerSocket { |
| + public: |
| + PepperTCPServerSocket(PepperMessageFilter* manager, |
| + int32 routing_id, |
| + uint32 plugin_dispatcher_id, |
| + uint32 socket_id); |
| + ~PepperTCPServerSocket(); |
| + |
| + 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_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket); |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |