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_ |