Speech refactoring: Reimplemented SpeechRecognitionManagerImpl as a FSM. (CL1.7)
[chromium-blink-merge.git] / net / server / web_socket.h
blob66ad7893da744a258ba34023e5dfaf14edd7a3ca
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.
5 #ifndef NET_SERVER_WEB_SOCKET_H_
6 #define NET_SERVER_WEB_SOCKET_H_
7 #pragma once
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
14 namespace net {
16 class HttpConnection;
17 class HttpServerRequestInfo;
19 class WebSocket {
20 public:
21 enum ParseResult {
22 FRAME_OK,
23 FRAME_INCOMPLETE,
24 FRAME_CLOSE,
25 FRAME_ERROR
28 static WebSocket* CreateWebSocket(HttpConnection* connection,
29 const HttpServerRequestInfo& request,
30 size_t* pos);
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;
35 virtual ~WebSocket() {}
37 protected:
38 explicit WebSocket(HttpConnection* connection);
39 HttpConnection* connection_;
41 private:
42 DISALLOW_COPY_AND_ASSIGN(WebSocket);
45 } // namespace net
47 #endif // NET_SERVER_WEB_SOCKET_H_