- add sources.
[platform/framework/web/crosswalk.git] / src / net / server / http_connection.h
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
3 // found in the LICENSE file.
4
5 #ifndef NET_SERVER_HTTP_CONNECTION_H_
6 #define NET_SERVER_HTTP_CONNECTION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "net/http/http_status_code.h"
13
14 namespace net {
15
16 class HttpServer;
17 class HttpServerResponseInfo;
18 class StreamListenSocket;
19 class WebSocket;
20
21 class HttpConnection {
22  public:
23   ~HttpConnection();
24
25   void Send(const std::string& data);
26   void Send(const char* bytes, int len);
27   void Send(const HttpServerResponseInfo& response);
28
29   void Shift(int num_bytes);
30
31   const std::string& recv_data() const { return recv_data_; }
32   int id() const { return id_; }
33
34  private:
35   friend class HttpServer;
36   static int last_id_;
37
38   HttpConnection(HttpServer* server, scoped_ptr<StreamListenSocket> sock);
39
40   HttpServer* server_;
41   scoped_ptr<StreamListenSocket> socket_;
42   scoped_ptr<WebSocket> web_socket_;
43   std::string recv_data_;
44   int id_;
45   DISALLOW_COPY_AND_ASSIGN(HttpConnection);
46 };
47
48 }  // namespace net
49
50 #endif  // NET_SERVER_HTTP_CONNECTION_H_