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

Side by Side Diff: net/server/http_server.h

Issue 10837177: Add a menu item to content_shell to open devtools to make it more discoverable. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix android compile, and add gtk support Created 8 years, 4 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SERVER_HTTP_SERVER_H_ 5 #ifndef NET_SERVER_HTTP_SERVER_H_
6 #define NET_SERVER_HTTP_SERVER_H_ 6 #define NET_SERVER_HTTP_SERVER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "net/base/stream_listen_socket.h" 13 #include "net/base/stream_listen_socket.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class HttpConnection; 17 class HttpConnection;
18 class HttpServerRequestInfo; 18 class HttpServerRequestInfo;
19 class IPEndPoint;
19 class WebSocket; 20 class WebSocket;
20 21
21 class HttpServer : public StreamListenSocket::Delegate, 22 class HttpServer : public StreamListenSocket::Delegate,
22 public base::RefCountedThreadSafe<HttpServer> { 23 public base::RefCountedThreadSafe<HttpServer> {
23 public: 24 public:
24 class Delegate { 25 class Delegate {
25 public: 26 public:
26 virtual void OnHttpRequest(int connection_id, 27 virtual void OnHttpRequest(int connection_id,
27 const HttpServerRequestInfo& info) = 0; 28 const HttpServerRequestInfo& info) = 0;
28 29
(...skipping 17 matching lines...) Expand all
46 void SendOverWebSocket(int connection_id, const std::string& data); 47 void SendOverWebSocket(int connection_id, const std::string& data);
47 void Send(int connection_id, const std::string& data); 48 void Send(int connection_id, const std::string& data);
48 void Send(int connection_id, const char* bytes, int len); 49 void Send(int connection_id, const char* bytes, int len);
49 void Send200(int connection_id, 50 void Send200(int connection_id,
50 const std::string& data, 51 const std::string& data,
51 const std::string& mime_type); 52 const std::string& mime_type);
52 void Send404(int connection_id); 53 void Send404(int connection_id);
53 void Send500(int connection_id, const std::string& message); 54 void Send500(int connection_id, const std::string& message);
54 void Close(int connection_id); 55 void Close(int connection_id);
55 56
57 // Copies the local address to |address|. Returns a network error code.
58 int GetLocalAddress(IPEndPoint* address);
59
56 // ListenSocketDelegate 60 // ListenSocketDelegate
57 virtual void DidAccept(StreamListenSocket* server, 61 virtual void DidAccept(StreamListenSocket* server,
58 StreamListenSocket* socket) OVERRIDE; 62 StreamListenSocket* socket) OVERRIDE;
59 virtual void DidRead(StreamListenSocket* socket, 63 virtual void DidRead(StreamListenSocket* socket,
60 const char* data, 64 const char* data,
61 int len) OVERRIDE; 65 int len) OVERRIDE;
62 virtual void DidClose(StreamListenSocket* socket) OVERRIDE; 66 virtual void DidClose(StreamListenSocket* socket) OVERRIDE;
63 67
64 protected: 68 protected:
65 virtual ~HttpServer(); 69 virtual ~HttpServer();
(...skipping 18 matching lines...) Expand all
84 IdToConnectionMap id_to_connection_; 88 IdToConnectionMap id_to_connection_;
85 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; 89 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap;
86 SocketToConnectionMap socket_to_connection_; 90 SocketToConnectionMap socket_to_connection_;
87 91
88 DISALLOW_COPY_AND_ASSIGN(HttpServer); 92 DISALLOW_COPY_AND_ASSIGN(HttpServer);
89 }; 93 };
90 94
91 } // namespace net 95 } // namespace net
92 96
93 #endif // NET_SERVER_HTTP_SERVER_H_ 97 #endif // NET_SERVER_HTTP_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698