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

Side by Side Diff: components/devtools_service/devtools_agent_host.cc

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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/devtools_service/devtools_agent_host.h"
6
7 #include "base/guid.h"
8 #include "base/logging.h"
9
10 namespace devtools_service {
11
12 DevToolsAgentHost::DevToolsAgentHost(DevToolsAgentPtr agent)
13 : id_(base::GenerateGUID()),
14 agent_(agent.Pass()),
15 binding_(this),
16 delegate_(nullptr) {
17 agent_.set_error_handler(this);
18 }
19
20 DevToolsAgentHost::~DevToolsAgentHost() {
21 if (delegate_)
22 delegate_->OnAgentHostClosed(this);
23 }
24
25 void DevToolsAgentHost::SetDelegate(Delegate* delegate) {
26 delegate_ = delegate;
27 if (delegate_) {
28 if (binding_.is_bound())
29 return;
30
31 DevToolsAgentClientPtr client;
32 binding_.Bind(&client);
33 agent_->SetClient(client.Pass(), id_);
34 } else {
35 if (!binding_.is_bound())
36 return;
37
38 binding_.Close();
39 }
40 }
41
42 void DevToolsAgentHost::SendProtocolMessageToAgent(const std::string& message) {
43 agent_->DispatchProtocolMessage(message);
44 }
45
46 void DevToolsAgentHost::DispatchProtocolMessage(const mojo::String& message) {
47 delegate_->DispatchProtocolMessage(this, message);
48 }
49
50 void DevToolsAgentHost::OnConnectionError() {
51 agent_connection_error_handler_.Run();
52 }
53
54 } // namespace devtools_service
OLDNEW
« no previous file with comments | « components/devtools_service/devtools_agent_host.h ('k') | components/devtools_service/devtools_http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698