OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_protocol.h" | 5 #include "content/browser/devtools/devtools_protocol.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 using base::DictionaryValue; | 25 using base::DictionaryValue; |
26 using base::Value; | 26 using base::Value; |
27 | 27 |
28 DevToolsProtocol::Command::~Command() { | 28 DevToolsProtocol::Command::~Command() { |
29 } | 29 } |
30 | 30 |
31 scoped_ptr<DevToolsProtocol::Response> | 31 scoped_ptr<DevToolsProtocol::Response> |
32 DevToolsProtocol::Command::SuccessResponse(base::DictionaryValue* result) { | 32 DevToolsProtocol::Command::SuccessResponse( |
| 33 base::DictionaryValue* result) const { |
33 return scoped_ptr<DevToolsProtocol::Response>( | 34 return scoped_ptr<DevToolsProtocol::Response>( |
34 new DevToolsProtocol::Response(id_, result)); | 35 new DevToolsProtocol::Response(id_, result)); |
35 } | 36 } |
36 | 37 |
37 scoped_ptr<DevToolsProtocol::Response> | 38 scoped_ptr<DevToolsProtocol::Response> |
38 DevToolsProtocol::Command::ErrorResponse(int error_code, | 39 DevToolsProtocol::Command::ErrorResponse( |
39 const std::string& error_message) { | 40 int error_code, |
| 41 const std::string& error_message) const { |
40 return scoped_ptr<DevToolsProtocol::Response>( | 42 return scoped_ptr<DevToolsProtocol::Response>( |
41 new DevToolsProtocol::Response(id_, error_code, error_message)); | 43 new DevToolsProtocol::Response(id_, error_code, error_message)); |
42 } | 44 } |
43 | 45 |
44 scoped_ptr<DevToolsProtocol::Response> | 46 scoped_ptr<DevToolsProtocol::Response> |
45 DevToolsProtocol::Command::NoSuchMethodErrorResponse() { | 47 DevToolsProtocol::Command::NoSuchMethodErrorResponse() const { |
46 return scoped_ptr<DevToolsProtocol::Response>( | 48 return scoped_ptr<DevToolsProtocol::Response>( |
47 new Response(id_, kErrorNoSuchMethod, "No such method")); | 49 new Response(id_, kErrorNoSuchMethod, "No such method")); |
48 } | 50 } |
49 | 51 |
50 DevToolsProtocol::Command::Command(int id, | 52 DevToolsProtocol::Command::Command(int id, |
51 const std::string& domain, | 53 const std::string& domain, |
52 const std::string& method, | 54 const std::string& method, |
53 DictionaryValue* params) | 55 DictionaryValue* params) |
54 : id_(id), | 56 : id_(id), |
55 domain_(domain), | 57 domain_(domain), |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 159 } |
158 | 160 |
159 std::string domain = method.substr(0, pos); | 161 std::string domain = method.substr(0, pos); |
160 | 162 |
161 base::DictionaryValue* params = NULL; | 163 base::DictionaryValue* params = NULL; |
162 command_dict->GetDictionary("params", ¶ms); | 164 command_dict->GetDictionary("params", ¶ms); |
163 return new Command(id, domain, method, params ? params->DeepCopy() : NULL); | 165 return new Command(id, domain, method, params ? params->DeepCopy() : NULL); |
164 } | 166 } |
165 | 167 |
166 } // namespace content | 168 } // namespace content |
OLD | NEW |