| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ServerSocket; | 23 class ServerSocket; |
| 24 class StreamSocket; | 24 class StreamSocket; |
| 25 class WebSocket; | 25 class WebSocket; |
| 26 | 26 |
| 27 class HttpServer { | 27 class HttpServer { |
| 28 public: | 28 public: |
| 29 // Delegate to handle http/websocket events. Beware that it is not safe to | 29 // Delegate to handle http/websocket events. Beware that it is not safe to |
| 30 // destroy the HttpServer in any of these callbacks. | 30 // destroy the HttpServer in any of these callbacks. |
| 31 class Delegate { | 31 class Delegate { |
| 32 public: | 32 public: |
| 33 virtual void OnConnect(int connection_id) = 0; |
| 33 virtual void OnHttpRequest(int connection_id, | 34 virtual void OnHttpRequest(int connection_id, |
| 34 const HttpServerRequestInfo& info) = 0; | 35 const HttpServerRequestInfo& info) = 0; |
| 35 virtual void OnWebSocketRequest(int connection_id, | 36 virtual void OnWebSocketRequest(int connection_id, |
| 36 const HttpServerRequestInfo& info) = 0; | 37 const HttpServerRequestInfo& info) = 0; |
| 37 virtual void OnWebSocketMessage(int connection_id, | 38 virtual void OnWebSocketMessage(int connection_id, |
| 38 const std::string& data) = 0; | 39 const std::string& data) = 0; |
| 39 virtual void OnClose(int connection_id) = 0; | 40 virtual void OnClose(int connection_id) = 0; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 HttpServer(scoped_ptr<ServerSocket> server_socket, | 43 HttpServer(scoped_ptr<ServerSocket> server_socket, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 IdToConnectionMap id_to_connection_; | 109 IdToConnectionMap id_to_connection_; |
| 109 | 110 |
| 110 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; | 111 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 113 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace net | 116 } // namespace net |
| 116 | 117 |
| 117 #endif // NET_SERVER_HTTP_SERVER_H_ | 118 #endif // NET_SERVER_HTTP_SERVER_H_ |
| OLD | NEW |