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

Unified Diff: mojo/spy/websocket_server.h

Issue 379753002: Redo: Adding a mojo interface to the mojo spy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bindings clash fix Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/spy/spy_server_impl.cc ('k') | mojo/spy/websocket_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/spy/websocket_server.h
diff --git a/mojo/spy/websocket_server.h b/mojo/spy/websocket_server.h
index 84830b8b8dad3f21499952e610fa05df5dc235d6..986b5796209652b32de677cb97176ea02ce5e554 100644
--- a/mojo/spy/websocket_server.h
+++ b/mojo/spy/websocket_server.h
@@ -5,14 +5,18 @@
#ifndef MOJO_SPY_WEBSOCKET_SERVER_H_
#define MOJO_SPY_WEBSOCKET_SERVER_H_
+#include <string>
+
+#include "mojo/spy/public/spy.mojom.h"
#include "net/server/http_server.h"
-namespace spy {
+namespace mojo {
-class WebSocketServer : public net::HttpServer::Delegate {
+class WebSocketServer : public net::HttpServer::Delegate,
+ public spy_api::SpyClient {
public:
// Pass 0 in |port| to listen in one available port.
- explicit WebSocketServer(int port);
+ explicit WebSocketServer(int port, ScopedMessagePipeHandle server_pipe);
virtual ~WebSocketServer();
// Begin accepting HTTP requests. Must be called from an IO MessageLoop.
bool Start();
@@ -32,13 +36,27 @@ class WebSocketServer : public net::HttpServer::Delegate {
const std::string& data) OVERRIDE;
virtual void OnClose(int connection_id) OVERRIDE;
+ // Overriden form spy_api::SpyClient.
+ virtual void OnFatalError(spy_api::Result result) OVERRIDE;
+ virtual void OnSessionEnd(spy_api::Result result) OVERRIDE;
+ virtual void OnClientConnection(
+ const mojo::String& name,
+ uint32_t id,
+ spy_api::ConnectionOptions options) OVERRIDE;
+ virtual void OnMessage(spy_api::MessagePtr message) OVERRIDE;
+
+ // Callbacks from calling spy_api::SpyServer.
+ void OnStartSession(spy_api::Result, mojo::String);
+
private:
int port_;
int connection_id_;
- scoped_refptr<net::HttpServer> server_;
+ scoped_refptr<net::HttpServer> web_server_;
+ spy_api::SpyServerPtr spy_server_;
+
DISALLOW_COPY_AND_ASSIGN(WebSocketServer);
};
-} // namespace spy
+} // namespace mojo
#endif // MOJO_SPY_WEBSOCKET_SERVER_H_
« no previous file with comments | « mojo/spy/spy_server_impl.cc ('k') | mojo/spy/websocket_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698