OLD | NEW |
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 #include "content/browser/devtools/protocol/devtools_protocol_client.h" | 5 #include "content/browser/devtools/protocol/devtools_protocol_client.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 DevToolsProtocolClient::DevToolsProtocolClient( | 9 DevToolsProtocolClient::DevToolsProtocolClient( |
10 const EventCallback& event_callback, | 10 const EventCallback& event_callback, |
11 const ResponseCallback& response_callback) | 11 const ResponseCallback& response_callback, |
| 12 const RawMessageCallback& raw_message_callback) |
12 : event_callback_(event_callback), | 13 : event_callback_(event_callback), |
13 response_callback_(response_callback) { | 14 response_callback_(response_callback), |
| 15 raw_message_callback_(raw_message_callback) { |
14 } | 16 } |
15 | 17 |
16 DevToolsProtocolClient::~DevToolsProtocolClient() { | 18 DevToolsProtocolClient::~DevToolsProtocolClient() { |
17 } | 19 } |
18 | 20 |
19 void DevToolsProtocolClient::SendNotification(const std::string& method, | 21 void DevToolsProtocolClient::SendNotification(const std::string& method, |
20 base::DictionaryValue* params) { | 22 base::DictionaryValue* params) { |
21 event_callback_.Run(method, params); | 23 event_callback_.Run(method, params); |
22 } | 24 } |
23 | 25 |
24 void DevToolsProtocolClient::SendAsyncResponse( | 26 void DevToolsProtocolClient::SendAsyncResponse( |
25 scoped_refptr<DevToolsProtocol::Response> response) { | 27 scoped_refptr<DevToolsProtocol::Response> response) { |
26 response_callback_.Run(response); | 28 response_callback_.Run(response); |
27 } | 29 } |
28 | 30 |
| 31 void DevToolsProtocolClient::SendRawMessage(const std::string& message) { |
| 32 raw_message_callback_.Run(message); |
| 33 } |
| 34 |
29 void DevToolsProtocolClient::SendInvalidParamsResponse( | 35 void DevToolsProtocolClient::SendInvalidParamsResponse( |
30 scoped_refptr<DevToolsProtocol::Command> command, | 36 scoped_refptr<DevToolsProtocol::Command> command, |
31 const std::string& message) { | 37 const std::string& message) { |
32 SendAsyncResponse(command->InvalidParamResponse(message)); | 38 SendAsyncResponse(command->InvalidParamResponse(message)); |
33 } | 39 } |
34 | 40 |
35 void DevToolsProtocolClient::SendInternalErrorResponse( | 41 void DevToolsProtocolClient::SendInternalErrorResponse( |
36 scoped_refptr<DevToolsProtocol::Command> command, | 42 scoped_refptr<DevToolsProtocol::Command> command, |
37 const std::string& message) { | 43 const std::string& message) { |
38 SendAsyncResponse(command->InternalErrorResponse(message)); | 44 SendAsyncResponse(command->InternalErrorResponse(message)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 90 } |
85 | 91 |
86 const std::string& Response::message() const { | 92 const std::string& Response::message() const { |
87 return message_; | 93 return message_; |
88 } | 94 } |
89 | 95 |
90 Response::Response() { | 96 Response::Response() { |
91 } | 97 } |
92 | 98 |
93 } // namespace content | 99 } // namespace content |
OLD | NEW |