| 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_WEB_SOCKET_H_ | 5 #ifndef NET_SERVER_WEB_SOCKET_H_ |
| 6 #define NET_SERVER_WEB_SOCKET_H_ | 6 #define NET_SERVER_WEB_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 enum ParseResult { | 23 enum ParseResult { |
| 24 FRAME_OK, | 24 FRAME_OK, |
| 25 FRAME_INCOMPLETE, | 25 FRAME_INCOMPLETE, |
| 26 FRAME_CLOSE, | 26 FRAME_CLOSE, |
| 27 FRAME_ERROR | 27 FRAME_ERROR |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 static WebSocket* CreateWebSocket(HttpServer* server, | 30 static WebSocket* CreateWebSocket(HttpServer* server, |
| 31 HttpConnection* connection, | 31 HttpConnection* connection, |
| 32 const HttpServerRequestInfo& request, | 32 const HttpServerRequestInfo& request); |
| 33 size_t* pos); | |
| 34 | 33 |
| 35 void Accept(const HttpServerRequestInfo& request); | 34 void Accept(const HttpServerRequestInfo& request); |
| 36 ParseResult Read(std::string* message); | 35 ParseResult Read(std::string* message); |
| 37 void Send(const std::string& message); | 36 void Send(const std::string& message); |
| 38 ~WebSocket(); | 37 ~WebSocket(); |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 WebSocket(HttpServer* server, | 40 WebSocket(HttpServer* server, |
| 42 HttpConnection* connection, | 41 HttpConnection* connection, |
| 43 const HttpServerRequestInfo& request, | 42 const HttpServerRequestInfo& request); |
| 44 size_t* pos); | |
| 45 | 43 |
| 46 HttpServer* const server_; | 44 HttpServer* const server_; |
| 47 HttpConnection* const connection_; | 45 HttpConnection* const connection_; |
| 48 scoped_ptr<WebSocketEncoder> encoder_; | 46 scoped_ptr<WebSocketEncoder> encoder_; |
| 49 std::string response_extensions_; | 47 std::string response_extensions_; |
| 50 bool closed_; | 48 bool closed_; |
| 51 | 49 |
| 52 DISALLOW_COPY_AND_ASSIGN(WebSocket); | 50 DISALLOW_COPY_AND_ASSIGN(WebSocket); |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 } // namespace net | 53 } // namespace net |
| 56 | 54 |
| 57 #endif // NET_SERVER_WEB_SOCKET_H_ | 55 #endif // NET_SERVER_WEB_SOCKET_H_ |
| OLD | NEW |