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

Side by Side Diff: sky/services/inspector/inspector_frontend_impl.h

Issue 710043004: Make it possible to have multiple InspectorBackends (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Actually works Created 6 years, 1 month 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
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 SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_ 5 #ifndef SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_
6 #define SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_ 6 #define SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_
7 7
8 #include "mojo/public/cpp/application/interface_factory_impl.h" 8 #include "mojo/public/cpp/application/interface_factory_impl.h"
9 #include "mojo/public/cpp/bindings/interface_impl.h" 9 #include "mojo/public/cpp/bindings/interface_impl.h"
10 #include "net/server/http_server.h" 10 #include "net/server/http_server.h"
11 #include "net/socket/tcp_server_socket.h" 11 #include "net/socket/tcp_server_socket.h"
12 #include "sky/services/inspector/inspector.mojom.h" 12 #include "sky/services/inspector/inspector.mojom.h"
13 13
14 namespace sky { 14 namespace sky {
15 namespace inspector { 15 namespace inspector {
16 16
17 class InspectorFrontendImpl : public mojo::InterfaceImpl<InspectorFrontend>, 17 class InspectorFrontendImpl : public mojo::InterfaceImpl<InspectorFrontend> {
18 public net::HttpServer::Delegate {
19 public: 18 public:
20 InspectorFrontendImpl(); 19 class Delegate {
20 public:
21 virtual void Register(InspectorFrontendImpl*) = 0;
22 virtual void Unregister(InspectorFrontendImpl*) = 0;
23
24 virtual void Listen(int32_t port) = 0;
25 virtual void SendMessage(const mojo::String&) = 0;
26 };
27
28 InspectorFrontendImpl(Delegate* delegate);
21 virtual ~InspectorFrontendImpl(); 29 virtual ~InspectorFrontendImpl();
22 30
23 private: 31 private:
24 // From net::HttpServer::Delegate 32 // From InspectorFrontend
25 virtual void OnConnect(int connection_id) override; 33 void Listen(int32_t port) override;
26 virtual void OnHttpRequest( 34 void SendMessage(const mojo::String& message) override;
27 int connection_id, const net::HttpServerRequestInfo& info) override;
28 virtual void OnWebSocketRequest(
29 int connection_id, const net::HttpServerRequestInfo& info) override;
30 virtual void OnWebSocketMessage(
31 int connection_id, const std::string& data) override;
32 virtual void OnClose(int connection_id) override;
33 35
34 // From InspectorFrontend 36 Delegate* delegate_;
35 virtual void Listen(int32_t port) override;
36 virtual void SendMessage(const mojo::String&) override;
37
38 void StopListening();
39
40 void Register(int port);
41 void Unregister();
42
43 int port_;
44 int connection_id_;
45 scoped_ptr<net::HttpServer> web_server_;
46 37
47 MOJO_DISALLOW_COPY_AND_ASSIGN(InspectorFrontendImpl); 38 MOJO_DISALLOW_COPY_AND_ASSIGN(InspectorFrontendImpl);
48 }; 39 };
49 40
50 typedef mojo::InterfaceFactoryImpl<
51 InspectorFrontendImpl> InspectorFrontendFactory;
52
53 } // namespace tester 41 } // namespace tester
54 } // namespace sky 42 } // namespace sky
55 43
56 #endif // SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_ 44 #endif // SKY_SERVICES_INSPECTOR_INSPECTOR_FRONTEND_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | sky/services/inspector/inspector_frontend_impl.cc » ('j') | sky/services/inspector/server.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698