| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/devtools/devtools_agent.h" | 5 #include "content/renderer/devtools/devtools_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (!is_attached_) | 320 if (!is_attached_) |
| 321 return; | 321 return; |
| 322 | 322 |
| 323 std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue()); | 323 std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue()); |
| 324 response->SetInteger("id", call_id); | 324 response->SetInteger("id", call_id); |
| 325 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 325 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
| 326 std::unique_ptr<base::ListValue> errors(new base::ListValue()); | 326 std::unique_ptr<base::ListValue> errors(new base::ListValue()); |
| 327 | 327 |
| 328 bool failed = false; | 328 bool failed = false; |
| 329 for (const auto& error : debug_info.errors) { | 329 for (const auto& error : debug_info.errors) { |
| 330 base::DictionaryValue* error_value = new base::DictionaryValue(); | 330 std::unique_ptr<base::DictionaryValue> error_value( |
| 331 errors->Append(error_value); | 331 new base::DictionaryValue()); |
| 332 error_value->SetString("message", error.message); | 332 error_value->SetString("message", error.message); |
| 333 error_value->SetBoolean("critical", error.critical); | 333 error_value->SetBoolean("critical", error.critical); |
| 334 error_value->SetInteger("line", error.line); | 334 error_value->SetInteger("line", error.line); |
| 335 error_value->SetInteger("column", error.column); | 335 error_value->SetInteger("column", error.column); |
| 336 if (error.critical) | 336 if (error.critical) |
| 337 failed = true; | 337 failed = true; |
| 338 errors->Append(std::move(error_value)); |
| 338 } | 339 } |
| 339 | 340 |
| 340 WebString url = frame_->GetWebFrame()->document().manifestURL().string(); | 341 WebString url = frame_->GetWebFrame()->document().manifestURL().string(); |
| 341 result->SetString("url", url); | 342 result->SetString("url", url); |
| 342 if (!failed) | 343 if (!failed) |
| 343 result->SetString("data", debug_info.raw_data); | 344 result->SetString("data", debug_info.raw_data); |
| 344 result->Set("errors", errors.release()); | 345 result->Set("errors", errors.release()); |
| 345 response->Set("result", result.release()); | 346 response->Set("result", result.release()); |
| 346 | 347 |
| 347 std::string json_message; | 348 std::string json_message; |
| 348 base::JSONWriter::Write(*response, &json_message); | 349 base::JSONWriter::Write(*response, &json_message); |
| 349 SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, | 350 SendChunkedProtocolMessage(this, routing_id(), session_id, call_id, |
| 350 json_message, std::string()); | 351 json_message, std::string()); |
| 351 } | 352 } |
| 352 | 353 |
| 353 } // namespace content | 354 } // namespace content |
| OLD | NEW |