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

Side by Side Diff: components/devtools_service/devtools_http_server.h

Issue 1164383002: Mandoline DevTools service: remote debugging protocol over HTTP/WebSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_ 5 #ifndef COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_
6 #define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_ 6 #define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/services/network/public/interfaces/http_connection.mojom.h" 12 #include "mojo/services/network/public/interfaces/http_connection.mojom.h"
13 #include "mojo/services/network/public/interfaces/http_message.mojom.h"
13 #include "mojo/services/network/public/interfaces/http_server.mojom.h" 14 #include "mojo/services/network/public/interfaces/http_server.mojom.h"
14 15
15 namespace devtools_service { 16 namespace devtools_service {
16 17
17 class DevToolsService; 18 class DevToolsService;
18 19
19 class DevToolsHttpServer : public mojo::HttpServerDelegate { 20 class DevToolsHttpServer : public mojo::HttpServerDelegate {
20 public: 21 public:
21 // |service| must outlive this object. 22 // |service| must outlive this object.
22 DevToolsHttpServer(DevToolsService* service, uint16_t remote_debugging_port); 23 DevToolsHttpServer(DevToolsService* service, uint16_t remote_debugging_port);
23 ~DevToolsHttpServer() override; 24 ~DevToolsHttpServer() override;
24 25
25 private: 26 private:
26 class HttpConnectionDelegateImpl; 27 class HttpConnectionDelegateImpl;
27 28
28 // mojo::HttpServerDelegate implementation. 29 // mojo::HttpServerDelegate implementation.
29 void OnConnected( 30 void OnConnected(
30 mojo::HttpConnectionPtr connection, 31 mojo::HttpConnectionPtr connection,
31 mojo::InterfaceRequest<mojo::HttpConnectionDelegate> delegate) override; 32 mojo::InterfaceRequest<mojo::HttpConnectionDelegate> delegate) override;
32 33
33 // The following methods are called by HttpConnectionDelegateImpl. 34 // The following three methods are called by HttpConnectionDelegateImpl.
34 using OnReceivedRequestCallback = 35 using OnReceivedRequestCallback =
35 mojo::HttpConnectionDelegate::OnReceivedRequestCallback; 36 mojo::HttpConnectionDelegate::OnReceivedRequestCallback;
36 void OnReceivedRequest(HttpConnectionDelegateImpl* connection, 37 void OnReceivedRequest(HttpConnectionDelegateImpl* connection,
37 mojo::HttpRequestPtr request, 38 mojo::HttpRequestPtr request,
38 const OnReceivedRequestCallback& callback); 39 const OnReceivedRequestCallback& callback);
39
40 using OnReceivedWebSocketRequestCallback = 40 using OnReceivedWebSocketRequestCallback =
41 mojo::HttpConnectionDelegate::OnReceivedWebSocketRequestCallback; 41 mojo::HttpConnectionDelegate::OnReceivedWebSocketRequestCallback;
42 void OnReceivedWebSocketRequest( 42 void OnReceivedWebSocketRequest(
43 HttpConnectionDelegateImpl* connection, 43 HttpConnectionDelegateImpl* connection,
44 mojo::HttpRequestPtr request, 44 mojo::HttpRequestPtr request,
45 const OnReceivedWebSocketRequestCallback& callback); 45 const OnReceivedWebSocketRequestCallback& callback);
46 void OnConnectionClosed(HttpConnectionDelegateImpl* connection);
46 47
47 void OnConnectionClosed(HttpConnectionDelegateImpl* connection); 48 mojo::HttpResponsePtr ProcessJsonRequest(mojo::HttpRequestPtr request);
48 49
49 // Not owned by this object. 50 // Not owned by this object.
50 DevToolsService* const service_; 51 DevToolsService* const service_;
51 52
53 const uint16_t remote_debugging_port_;
54
52 scoped_ptr<mojo::Binding<mojo::HttpServerDelegate>> 55 scoped_ptr<mojo::Binding<mojo::HttpServerDelegate>>
53 http_server_delegate_binding_; 56 http_server_delegate_binding_;
54 57
55 // Owns the elements. 58 // Owns the elements.
56 std::set<HttpConnectionDelegateImpl*> connections_; 59 std::set<HttpConnectionDelegateImpl*> connections_;
57 60
58 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpServer); 61 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpServer);
59 }; 62 };
60 63
61 } // namespace devtools_service 64 } // namespace devtools_service
62 65
63 #endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_ 66 #endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_HTTP_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698