| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SERVER_HTTP_SERVER_H_ | 5 #ifndef NET_SERVER_HTTP_SERVER_H_ |
| 6 #define NET_SERVER_HTTP_SERVER_H_ | 6 #define NET_SERVER_HTTP_SERVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 virtual void OnWebSocketMessage(int connection_id, | 33 virtual void OnWebSocketMessage(int connection_id, |
| 34 const std::string& data) = 0; | 34 const std::string& data) = 0; |
| 35 | 35 |
| 36 virtual void OnClose(int connection_id) = 0; | 36 virtual void OnClose(int connection_id) = 0; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~Delegate() {} | 39 virtual ~Delegate() {} |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 HttpServer(const std::string& host, int port, HttpServer::Delegate* del); | 42 HttpServer(const StreamListenSocketFactory& socket_factory, |
| 43 HttpServer::Delegate* delegate); |
| 43 | 44 |
| 44 void AcceptWebSocket(int connection_id, | 45 void AcceptWebSocket(int connection_id, |
| 45 const HttpServerRequestInfo& request); | 46 const HttpServerRequestInfo& request); |
| 46 void SendOverWebSocket(int connection_id, const std::string& data); | 47 void SendOverWebSocket(int connection_id, const std::string& data); |
| 47 void Send(int connection_id, const std::string& data); | 48 void Send(int connection_id, const std::string& data); |
| 48 void Send(int connection_id, const char* bytes, int len); | 49 void Send(int connection_id, const char* bytes, int len); |
| 49 void Send200(int connection_id, | 50 void Send200(int connection_id, |
| 50 const std::string& data, | 51 const std::string& data, |
| 51 const std::string& mime_type); | 52 const std::string& mime_type); |
| 52 void Send404(int connection_id); | 53 void Send404(int connection_id); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 IdToConnectionMap id_to_connection_; | 85 IdToConnectionMap id_to_connection_; |
| 85 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; | 86 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; |
| 86 SocketToConnectionMap socket_to_connection_; | 87 SocketToConnectionMap socket_to_connection_; |
| 87 | 88 |
| 88 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 89 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace net | 92 } // namespace net |
| 92 | 93 |
| 93 #endif // NET_SERVER_HTTP_SERVER_H_ | 94 #endif // NET_SERVER_HTTP_SERVER_H_ |
| OLD | NEW |