Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: net/server/web_socket.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 11
12 namespace net { 12 namespace net {
13 13
14 class HttpConnection; 14 class HttpConnection;
15 class HttpServerRequestInfo; 15 class HttpServerRequestInfo;
16 16
17 class WebSocket { 17 class WebSocket {
18 public: 18 public:
19 enum ParseResult { 19 enum ParseResult { FRAME_OK, FRAME_INCOMPLETE, FRAME_CLOSE, FRAME_ERROR };
20 FRAME_OK,
21 FRAME_INCOMPLETE,
22 FRAME_CLOSE,
23 FRAME_ERROR
24 };
25 20
26 static WebSocket* CreateWebSocket(HttpConnection* connection, 21 static WebSocket* CreateWebSocket(HttpConnection* connection,
27 const HttpServerRequestInfo& request, 22 const HttpServerRequestInfo& request,
28 size_t* pos); 23 size_t* pos);
29 24
30 static ParseResult DecodeFrameHybi17(const std::string& frame, 25 static ParseResult DecodeFrameHybi17(const std::string& frame,
31 bool client_frame, 26 bool client_frame,
32 int* bytes_consumed, 27 int* bytes_consumed,
33 std::string* output); 28 std::string* output);
34 29
35 static std::string EncodeFrameHybi17(const std::string& data, 30 static std::string EncodeFrameHybi17(const std::string& data,
36 int masking_key); 31 int masking_key);
37 32
38 virtual void Accept(const HttpServerRequestInfo& request) = 0; 33 virtual void Accept(const HttpServerRequestInfo& request) = 0;
39 virtual ParseResult Read(std::string* message) = 0; 34 virtual ParseResult Read(std::string* message) = 0;
40 virtual void Send(const std::string& message) = 0; 35 virtual void Send(const std::string& message) = 0;
41 virtual ~WebSocket() {} 36 virtual ~WebSocket() {}
42 37
43 protected: 38 protected:
44 explicit WebSocket(HttpConnection* connection); 39 explicit WebSocket(HttpConnection* connection);
45 HttpConnection* connection_; 40 HttpConnection* connection_;
46 41
47 private: 42 private:
48 DISALLOW_COPY_AND_ASSIGN(WebSocket); 43 DISALLOW_COPY_AND_ASSIGN(WebSocket);
49 }; 44 };
50 45
51 } // namespace net 46 } // namespace net
52 47
53 #endif // NET_SERVER_WEB_SOCKET_H_ 48 #endif // NET_SERVER_WEB_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698