| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 class PepperMessageFilter; |
| 13 struct PP_NetAddress_Private; |
| 14 |
| 15 namespace net { |
| 16 class ServerSocket; |
| 17 class StreamSocket; |
| 18 } |
| 19 |
| 20 // PepperTCPSocket is used by PepperMessageFilter to handle requests |
| 21 // from the Pepper TCP server socket API |
| 22 // (PPB_TCPServerSocket_Private). |
| 23 class PepperTCPServerSocket { |
| 24 public: |
| 25 PepperTCPServerSocket(PepperMessageFilter* manager, |
| 26 int32 routing_id, |
| 27 uint32 plugin_dispatcher_id, |
| 28 uint32 real_socket_id, |
| 29 uint32 temp_socket_id); |
| 30 ~PepperTCPServerSocket(); |
| 31 |
| 32 void Listen(const PP_NetAddress_Private& addr, int32 backlog); |
| 33 void Accept(); |
| 34 |
| 35 private: |
| 36 enum State { |
| 37 BEFORE_LISTENING, |
| 38 LISTEN_IN_PROGRESS, |
| 39 LISTENING, |
| 40 ACCEPT_IN_PROGRESS, |
| 41 }; |
| 42 |
| 43 void CancelListenRequest(); |
| 44 void SendAcceptACKError(); |
| 45 |
| 46 void OnListenCompleted(int result); |
| 47 void OnAcceptCompleted(int result); |
| 48 |
| 49 PepperMessageFilter* manager_; |
| 50 int32 routing_id_; |
| 51 uint32 plugin_dispatcher_id_; |
| 52 uint32 real_socket_id_; |
| 53 uint32 temp_socket_id_; |
| 54 |
| 55 State state_; |
| 56 |
| 57 scoped_ptr<net::ServerSocket> socket_; |
| 58 scoped_ptr<net::StreamSocket> socket_buffer_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket); |
| 61 }; |
| 62 |
| 63 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
| OLD | NEW |