OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "content/browser/devtools/devtools_session.h" | 5 #include "content/browser/devtools/devtools_session.h" |
6 | 6 |
7 #include "content/browser/devtools/devtools_agent_host_impl.h" | 7 #include "content/browser/devtools/devtools_agent_host_impl.h" |
8 #include "content/browser/devtools/protocol/protocol.h" | 8 #include "content/browser/devtools/protocol/protocol.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 DevToolsSession::DevToolsSession( | 12 DevToolsSession::DevToolsSession( |
13 DevToolsAgentHostImpl* agent_host, | 13 DevToolsAgentHostImpl* agent_host, |
14 int session_id) | 14 int session_id) |
15 : agent_host_(agent_host), | 15 : agent_host_(agent_host), |
16 session_id_(session_id), | 16 session_id_(session_id), |
17 dispatcher_(new protocol::UberDispatcher(this)) { | 17 dispatcher_(new protocol::UberDispatcher(this)) { |
18 } | 18 } |
19 | 19 |
20 DevToolsSession::~DevToolsSession() {} | 20 DevToolsSession::~DevToolsSession() {} |
21 | 21 |
22 void DevToolsSession::ResetDispatcher() { | 22 void DevToolsSession::ResetDispatcher() { |
23 dispatcher_.reset(); | 23 dispatcher_.reset(); |
24 } | 24 } |
25 | 25 |
26 void DevToolsSession::sendProtocolResponse( | 26 void DevToolsSession::sendProtocolResponse( |
27 int call_id, | 27 int call_id, |
28 const std::string& message) { | 28 std::unique_ptr<protocol::Serializable> message) { |
29 agent_host_->SendMessageToClient(session_id_, message); | 29 agent_host_->SendMessageToClient(session_id_, |
| 30 message->serializeValue()->toJSONString()); |
30 } | 31 } |
31 | 32 |
32 void DevToolsSession::sendProtocolNotification(const std::string& message) { | 33 void DevToolsSession::sendProtocolNotification( |
33 agent_host_->SendMessageToClient(session_id_, message); | 34 std::unique_ptr<protocol::Serializable> message) { |
| 35 agent_host_->SendMessageToClient(session_id_, |
| 36 message->serializeValue()->toJSONString()); |
34 } | 37 } |
35 | 38 |
36 void DevToolsSession::flushProtocolNotifications() { | 39 void DevToolsSession::flushProtocolNotifications() { |
37 } | 40 } |
38 | 41 |
39 } // namespace content | 42 } // namespace content |
OLD | NEW |