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

Side by Side Diff: chrome/browser/google_apis/test_server/http_connection.h

Issue 11275306: Revert 167627 - HTTP server for testing Google APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
(Empty)
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 CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/string_piece.h"
12 #include "chrome/browser/google_apis/test_server/http_request.h"
13 #include "net/base/stream_listen_socket.h"
14
15 namespace drive {
16 namespace test_server {
17
18 class HttpConnection;
19 class HttpResponse;
20
21 // Calblack called when a request is parsed. Response should be sent
22 // using HttpConnection::SendResponse() on the |connection| argument.
23 typedef base::Callback<void(HttpConnection* connection,
24 scoped_ptr<HttpRequest> request)>
25 HandleRequestCallback;
26
27 // Wraps the connection socket. Accepts incoming data and sends responses.
28 // If a valid request is parsed, then |callback_| is invoked.
29 class HttpConnection {
30 public:
31 HttpConnection(net::StreamListenSocket* socket,
32 const HandleRequestCallback& callback);
33 ~HttpConnection();
34
35 // Sends the HTTP response to the client.
36 void SendResponse(scoped_ptr<HttpResponse> response) const;
37
38 private:
39 friend class HttpServer;
40
41 // Accepts raw chunk of data from the client. Internally, passes it to the
42 // HttpRequestParser class. If a request is parsed, then |callback_| is
43 // called.
44 void ReceiveData(const base::StringPiece& data);
45
46 scoped_refptr<net::StreamListenSocket> socket_;
47 const HandleRequestCallback callback_;
48 HttpRequestParser request_parser_;
49
50 DISALLOW_COPY_AND_ASSIGN(HttpConnection);
51 };
52
53 } // namespace test_server
54 } // namespace drive
55
56 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/DEPS ('k') | chrome/browser/google_apis/test_server/http_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698