Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SERVER_WEB_SOCKET_H_ | |
| 6 #define NET_SERVER_WEB_SOCKET_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "net/server/http_server.h" | |
| 12 | |
| 13 #include <string> | |
| 14 #include <vector> | |
| 15 | |
| 16 namespace net { | |
| 17 | |
| 18 class HttpServerRequestInfo; | |
| 19 | |
| 20 class WebSocket { | |
| 21 public: | |
| 22 static WebSocket* createWebSocket(Connection* connection, | |
|
eroman
2011/08/02 18:46:41
CreateWebSocket
| |
| 23 const HttpServerRequestInfo& request, | |
| 24 size_t* pos); | |
| 25 | |
| 26 enum ParseResult { | |
|
eroman
2011/08/02 18:46:41
Move this to the top of the public section.
| |
| 27 FrameOK, | |
| 28 FrameIncomplete, | |
| 29 FrameError | |
|
eroman
2011/08/02 18:46:41
Chrome is using ALL_UPER_CASE_FOR_ENUMS
| |
| 30 }; | |
| 31 | |
| 32 virtual void Accept(const HttpServerRequestInfo& request) = 0; | |
| 33 virtual ParseResult Read(std::string* message) = 0; | |
| 34 virtual void Send(const std::string& message) = 0; | |
|
eroman
2011/08/02 18:46:41
Please add a virtual destructor.
I always recomme
| |
| 35 | |
| 36 protected: | |
| 37 WebSocket(Connection* connection); | |
|
eroman
2011/08/02 18:46:41
mark this as explicit.
| |
| 38 Connection* connection_; | |
| 39 }; | |
| 40 | |
| 41 } // namespace net | |
| 42 | |
| 43 #endif // NET_SERVER_WEB_SOCKET_H_ | |
| OLD | NEW |