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

Unified Diff: sky/framework/inspector/server/inspector_frontend_impl.h

Issue 687673003: Add beginnings of an inspector backend for Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
Index: sky/framework/inspector/server/inspector_frontend_impl.h
diff --git a/sky/framework/inspector/server/inspector_frontend_impl.h b/sky/framework/inspector/server/inspector_frontend_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd9e726fdecf6d805afadece37a3bd4f7003f696
--- /dev/null
+++ b/sky/framework/inspector/server/inspector_frontend_impl.h
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_FRAMEWORK_INSPECTOR_SERVER_INSPECTOR_FRONTEND_IMPL_H_
+#define SKY_FRAMEWORK_INSPECTOR_SERVER_INSPECTOR_FRONTEND_IMPL_H_
+
+#include "mojo/public/cpp/application/interface_factory_impl.h"
+#include "mojo/public/cpp/bindings/interface_impl.h"
+#include "net/server/http_server.h"
+#include "net/socket/tcp_server_socket.h"
+#include "sky/framework/inspector/server/inspector.mojom.h"
+
+namespace sky {
+namespace inspector {
+
+class InspectorFronendImpl : public mojo::InterfaceImpl<InspectorFrontend>,
+ public net::HttpServer::Delegate {
+ public:
+ InspectorFronendImpl();
+ virtual ~InspectorFronendImpl();
+
+ private:
+ // From net::HttpServer::Delegate
+ virtual void OnConnect(int connection_id) override;
+ virtual void OnHttpRequest(
+ int connection_id, const net::HttpServerRequestInfo& info) override;
+ virtual void OnWebSocketRequest(
+ int connection_id, const net::HttpServerRequestInfo& info) override;
+ virtual void OnWebSocketMessage(
+ int connection_id, const std::string& data) override;
+ virtual void OnClose(int connection_id) override;
+
+ // From InspectorFronend
+ virtual void Listen(int32_t port) override;
+ virtual void SendMessage(const mojo::String&) override;
+
+ void StopListening();
+
+ void Register(int port);
+ void Unregister();
+
+ int port_;
+ int connection_id_;
+ scoped_ptr<net::HttpServer> web_server_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(InspectorFronendImpl);
+};
+
+typedef mojo::InterfaceFactoryImpl<
+ InspectorFronendImpl> InspectorFronendFactory;
+
+} // namespace tester
+} // namespace sky
+
+#endif // SKY_FRAMEWORK_INSPECTOR_SERVER_INSPECTOR_FRONTEND_IMPL_H_
« no previous file with comments | « sky/framework/inspector/server/inspector.mojom ('k') | sky/framework/inspector/server/inspector_frontend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698