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

Side by Side Diff: mojo/spy/websocket_server.h

Issue 354043003: Add support for logging information about mojo messages retrieved by the mojo debugger (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indentation Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_SPY_WEBSOCKET_SERVER_H_ 5 #ifndef MOJO_SPY_WEBSOCKET_SERVER_H_
6 #define MOJO_SPY_WEBSOCKET_SERVER_H_ 6 #define MOJO_SPY_WEBSOCKET_SERVER_H_
7 7
8 #include "mojo/spy/common.h"
8 #include "net/server/http_server.h" 9 #include "net/server/http_server.h"
9 10
11 namespace base {
12 class Time;
13 };
14
15 class GURL;
16
10 namespace spy { 17 namespace spy {
11 18
12 class WebSocketServer : public net::HttpServer::Delegate { 19 class WebSocketServer : public net::HttpServer::Delegate {
13 public: 20 public:
14 // Pass 0 in |port| to listen in one available port. 21 // Pass 0 in |port| to listen in one available port.
15 explicit WebSocketServer(int port); 22 explicit WebSocketServer(int port);
16 virtual ~WebSocketServer(); 23 virtual ~WebSocketServer();
17 // Begin accepting HTTP requests. Must be called from an IO MessageLoop. 24 // Begin accepting HTTP requests. Must be called from an IO MessageLoop.
18 bool Start(); 25 bool Start();
19 // Returns the listening port, useful if 0 was passed to the contructor. 26 // Returns the listening port, useful if 0 was passed to the contructor.
20 int port() const { return port_; } 27 int port() const { return port_; }
21 28
29 // Maintains a log of the message passed in.
30 void LogMessageInfo(
31 const mojo::MojoMessageHeader& message_header,
32 const GURL& url,
33 const base::Time& message_time);
34
22 protected: 35 protected:
23 // Overridden from net::HttpServer::Delegate. 36 // Overridden from net::HttpServer::Delegate.
24 virtual void OnHttpRequest( 37 virtual void OnHttpRequest(
25 int connection_id, 38 int connection_id,
26 const net::HttpServerRequestInfo& info) OVERRIDE; 39 const net::HttpServerRequestInfo& info) OVERRIDE;
27 virtual void OnWebSocketRequest( 40 virtual void OnWebSocketRequest(
28 int connection_id, 41 int connection_id,
29 const net::HttpServerRequestInfo& info) OVERRIDE; 42 const net::HttpServerRequestInfo& info) OVERRIDE;
30 virtual void OnWebSocketMessage( 43 virtual void OnWebSocketMessage(
31 int connection_id, 44 int connection_id,
32 const std::string& data) OVERRIDE; 45 const std::string& data) OVERRIDE;
33 virtual void OnClose(int connection_id) OVERRIDE; 46 virtual void OnClose(int connection_id) OVERRIDE;
34 47
35 private: 48 private:
36 int port_; 49 int port_;
37 int connection_id_; 50 int connection_id_;
38 scoped_refptr<net::HttpServer> server_; 51 scoped_refptr<net::HttpServer> server_;
39 DISALLOW_COPY_AND_ASSIGN(WebSocketServer); 52 DISALLOW_COPY_AND_ASSIGN(WebSocketServer);
40 }; 53 };
41 54
42 } // namespace spy 55 } // namespace spy
43 56
44 #endif // MOJO_SPY_WEBSOCKET_SERVER_H_ 57 #endif // MOJO_SPY_WEBSOCKET_SERVER_H_
OLDNEW
« no previous file with comments | « mojo/spy/spy.cc ('k') | mojo/spy/websocket_server.cc » ('j') | mojo/spy/websocket_server.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698