chromeos: bluetooth: add BluetoothInputClient
[chromium-blink-merge.git] / net / server / http_connection.h
blobe22cb27eaa1981b2e6ccfe7736abaa91cafb0f0b
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_HTTP_CONNECTION_H_
6 #define NET_SERVER_HTTP_CONNECTION_H_
7 #pragma once
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
15 namespace net {
17 class HttpServer;
18 class ListenSocket;
19 class WebSocket;
21 class HttpConnection {
22 public:
23 void Send(const std::string& data);
24 void Send(const char* bytes, int len);
25 void Send200(const std::string& data, const std::string& content_type);
26 void Send404();
27 void Send500(const std::string& message);
29 void Shift(int num_bytes);
31 const std::string& recv_data() const { return recv_data_; }
32 int id() const { return id_; }
34 private:
35 friend class HttpServer;
36 static int last_id_;
38 HttpConnection(HttpServer* server, ListenSocket* sock);
39 ~HttpConnection();
41 void DetachSocket();
43 HttpServer* server_;
44 scoped_refptr<ListenSocket> socket_;
45 scoped_ptr<WebSocket> web_socket_;
46 std::string recv_data_;
47 int id_;
48 DISALLOW_COPY_AND_ASSIGN(HttpConnection);
51 } // namespace net
53 #endif // NET_SERVER_HTTP_CONNECTION_H_