1 // Copyright (c) 2013 Intel Corporation. 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.
5 #ifndef XWALK_SYSAPPS_RAW_SOCKET_TCP_SERVER_SOCKET_OBJECT_H_
6 #define XWALK_SYSAPPS_RAW_SOCKET_TCP_SERVER_SOCKET_OBJECT_H_
9 #include "net/socket/tcp_server_socket.h"
10 #include "xwalk/sysapps/common/event_target.h"
11 #include "xwalk/sysapps/raw_socket/raw_socket_extension.h"
12 #include "xwalk/sysapps/raw_socket/raw_socket_object.h"
17 class BindingObjectStore;
19 class TCPServerSocketObject : public RawSocketObject {
21 explicit TCPServerSocketObject(RawSocketInstance* instance);
22 virtual ~TCPServerSocketObject();
27 // EventTarget implementation.
28 virtual void StartEvent(const std::string& type) OVERRIDE;
29 virtual void StopEvent(const std::string& type) OVERRIDE;
31 // JavaScript function handlers.
32 void OnInit(scoped_ptr<XWalkExtensionFunctionInfo> info);
33 void OnClose(scoped_ptr<XWalkExtensionFunctionInfo> info);
34 void OnSuspend(scoped_ptr<XWalkExtensionFunctionInfo> info);
35 void OnResume(scoped_ptr<XWalkExtensionFunctionInfo> info);
37 // net::TCPServerSocket callbacks.
38 void OnAccept(int status);
43 scoped_ptr<net::TCPServerSocket> socket_;
44 scoped_ptr<net::StreamSocket> accepted_socket_;
46 RawSocketInstance* instance_;
49 } // namespace sysapps
52 #endif // XWALK_SYSAPPS_RAW_SOCKET_TCP_SERVER_SOCKET_OBJECT_H_