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

Side by Side Diff: ui/devtools/devtools_client.cc

Issue 2374513002: Add ui devtools server (Closed)
Patch Set: Initial commit for ui devtools server Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/devtools/devtools_client.h"
6
7 #include "ui/devtools/devtools_server.h"
8 #include "ui/devtools/Protocol.h"
9
10 namespace ui {
11 namespace devtools {
12
13 UiDevToolsClient::UiDevToolsClient(String name, UiDevToolsServer* server)
14 : name_(name), connected_client_id(-1), dispatcher_(this), server_(server) {
15 DCHECK(server_);
16 }
17
18 UiDevToolsClient::~UiDevToolsClient() {}
19
20 void UiDevToolsClient::AddDOMBackend(
21 std::unique_ptr<protocol::DOM::Backend> dom_backend) {
22 dom_backend_ = std::move(dom_backend);
23 protocol::DOM::Dispatcher::wire(&dispatcher_, dom_backend_.get());
24 }
25
26 void UiDevToolsClient::sendProtocolResponse(int callId, const String& message) {
27 server_->SendOverWebSocket(connected_client_id, message);
28 }
29
30 void UiDevToolsClient::sendProtocolNotification(const String& message) {
31 server_->SendOverWebSocket(connected_client_id, message);
32 }
33
34 void UiDevToolsClient::flushProtocolNotifications() {
35 NOTIMPLEMENTED();
36 }
37
38 void UiDevToolsClient::Dispatch(const String& data) {
39 dispatcher_.dispatch(protocol::parseJSON(data));
40 }
41
42 } // namespace devtools
43 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698