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 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 DevToolsProtocolClient::~DevToolsProtocolClient() { | 40 DevToolsProtocolClient::~DevToolsProtocolClient() { |
41 } | 41 } |
42 | 42 |
43 void DevToolsProtocolClient::SendRawMessage(const std::string& message) { | 43 void DevToolsProtocolClient::SendRawMessage(const std::string& message) { |
44 raw_message_callback_.Run(message); | 44 raw_message_callback_.Run(message); |
45 } | 45 } |
46 | 46 |
47 void DevToolsProtocolClient::SendMessage(const base::DictionaryValue& message) { | 47 void DevToolsProtocolClient::SendMessage(const base::DictionaryValue& message) { |
48 std::string json_message; | 48 std::string json_message; |
49 base::JSONWriter::Write(&message, &json_message); | 49 base::JSONWriter::Write(message, &json_message); |
50 SendRawMessage(json_message); | 50 SendRawMessage(json_message); |
51 } | 51 } |
52 | 52 |
53 void DevToolsProtocolClient::SendNotification( | 53 void DevToolsProtocolClient::SendNotification( |
54 const std::string& method, | 54 const std::string& method, |
55 scoped_ptr<base::DictionaryValue> params) { | 55 scoped_ptr<base::DictionaryValue> params) { |
56 base::DictionaryValue notification; | 56 base::DictionaryValue notification; |
57 notification.SetString(kMethodParam, method); | 57 notification.SetString(kMethodParam, method); |
58 if (params) | 58 if (params) |
59 notification.Set(kParamsParam, params.release()); | 59 notification.Set(kParamsParam, params.release()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 Response::Response(int status) | 133 Response::Response(int status) |
134 : status_(status) { | 134 : status_(status) { |
135 } | 135 } |
136 | 136 |
137 Response::Response(int status, const std::string& message) | 137 Response::Response(int status, const std::string& message) |
138 : status_(status), | 138 : status_(status), |
139 message_(message) { | 139 message_(message) { |
140 } | 140 } |
141 | 141 |
142 } // namespace content | 142 } // namespace content |
OLD | NEW |