| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/shell/browser/shell_devtools_frontend.h" | 5 #include "content/shell/browser/shell_devtools_frontend.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 DCHECK(source); | 286 DCHECK(source); |
| 287 PendingRequestsMap::iterator it = pending_requests_.find(source); | 287 PendingRequestsMap::iterator it = pending_requests_.find(source); |
| 288 DCHECK(it != pending_requests_.end()); | 288 DCHECK(it != pending_requests_.end()); |
| 289 | 289 |
| 290 base::DictionaryValue response; | 290 base::DictionaryValue response; |
| 291 base::DictionaryValue* headers = new base::DictionaryValue(); | 291 base::DictionaryValue* headers = new base::DictionaryValue(); |
| 292 net::HttpResponseHeaders* rh = source->GetResponseHeaders(); | 292 net::HttpResponseHeaders* rh = source->GetResponseHeaders(); |
| 293 response.SetInteger("statusCode", rh ? rh->response_code() : 200); | 293 response.SetInteger("statusCode", rh ? rh->response_code() : 200); |
| 294 response.Set("headers", headers); | 294 response.Set("headers", headers); |
| 295 | 295 |
| 296 void* iterator = NULL; | 296 size_t iterator = 0; |
| 297 std::string name; | 297 std::string name; |
| 298 std::string value; | 298 std::string value; |
| 299 while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) | 299 while (rh && rh->EnumerateHeaderLines(iterator, &name, &value)) |
| 300 headers->SetString(name, value); | 300 headers->SetString(name, value); |
| 301 | 301 |
| 302 SendMessageAck(it->second, &response); | 302 SendMessageAck(it->second, &response); |
| 303 pending_requests_.erase(it); | 303 pending_requests_.erase(it); |
| 304 delete source; | 304 delete source; |
| 305 } | 305 } |
| 306 | 306 |
| 307 void ShellDevToolsFrontend::CallClientFunction( | 307 void ShellDevToolsFrontend::CallClientFunction( |
| 308 const std::string& function_name, | 308 const std::string& function_name, |
| 309 const base::Value* arg1, | 309 const base::Value* arg1, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 334 CallClientFunction("DevToolsAPI.embedderMessageAck", | 334 CallClientFunction("DevToolsAPI.embedderMessageAck", |
| 335 &id_value, arg, nullptr); | 335 &id_value, arg, nullptr); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void ShellDevToolsFrontend::AgentHostClosed( | 338 void ShellDevToolsFrontend::AgentHostClosed( |
| 339 DevToolsAgentHost* agent_host, bool replaced) { | 339 DevToolsAgentHost* agent_host, bool replaced) { |
| 340 frontend_shell_->Close(); | 340 frontend_shell_->Close(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace content | 343 } // namespace content |
| OLD | NEW |