| 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 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 | 10 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 base::DictionaryValue* params) { | 268 base::DictionaryValue* params) { |
| 269 return new Notification(method, params); | 269 return new Notification(method, params); |
| 270 } | 270 } |
| 271 | 271 |
| 272 // static | 272 // static |
| 273 base::DictionaryValue* DevToolsProtocol::ParseMessage( | 273 base::DictionaryValue* DevToolsProtocol::ParseMessage( |
| 274 const std::string& json, | 274 const std::string& json, |
| 275 std::string* error_response) { | 275 std::string* error_response) { |
| 276 int parse_error_code; | 276 int parse_error_code; |
| 277 std::string error_message; | 277 std::string error_message; |
| 278 scoped_ptr<Value> message( | 278 scoped_ptr<base::Value> message( |
| 279 base::JSONReader::ReadAndReturnError( | 279 base::JSONReader::ReadAndReturnError( |
| 280 json, 0, &parse_error_code, &error_message)); | 280 json, 0, &parse_error_code, &error_message)); |
| 281 | 281 |
| 282 if (!message || !message->IsType(Value::TYPE_DICTIONARY)) { | 282 if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) { |
| 283 scoped_refptr<Response> response = | 283 scoped_refptr<Response> response = |
| 284 new Response(0, kErrorParseError, error_message); | 284 new Response(0, kErrorParseError, error_message); |
| 285 if (error_response) | 285 if (error_response) |
| 286 *error_response = response->Serialize(); | 286 *error_response = response->Serialize(); |
| 287 return NULL; | 287 return NULL; |
| 288 } | 288 } |
| 289 | 289 |
| 290 return static_cast<base::DictionaryValue*>(message.release()); | 290 return static_cast<base::DictionaryValue*>(message.release()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace content | 293 } // namespace content |
| OLD | NEW |