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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class HttpConnection; | 16 class HttpConnection; |
17 class HttpServer; | 17 class HttpServer; |
18 class HttpServerRequestInfo; | 18 class HttpServerRequestInfo; |
19 class WebSocketEncoder; | 19 class WebSocketEncoder; |
20 | 20 |
21 class WebSocket final { | 21 class WebSocket final { |
(...skipping 11 matching lines...) Expand all Loading... |
33 ParseResult Read(std::string* message); | 33 ParseResult Read(std::string* message); |
34 void Send(const std::string& message); | 34 void Send(const std::string& message); |
35 ~WebSocket(); | 35 ~WebSocket(); |
36 | 36 |
37 private: | 37 private: |
38 void Fail(); | 38 void Fail(); |
39 void SendErrorResponse(const std::string& message); | 39 void SendErrorResponse(const std::string& message); |
40 | 40 |
41 HttpServer* const server_; | 41 HttpServer* const server_; |
42 HttpConnection* const connection_; | 42 HttpConnection* const connection_; |
43 scoped_ptr<WebSocketEncoder> encoder_; | 43 std::unique_ptr<WebSocketEncoder> encoder_; |
44 bool closed_; | 44 bool closed_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(WebSocket); | 46 DISALLOW_COPY_AND_ASSIGN(WebSocket); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace net | 49 } // namespace net |
50 | 50 |
51 #endif // NET_SERVER_WEB_SOCKET_H_ | 51 #endif // NET_SERVER_WEB_SOCKET_H_ |
OLD | NEW |