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/browser/debugger/devtools_http_handler_impl.h" | 5 #include "content/browser/debugger/devtools_http_handler_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 "%s%shost=%s&page=%d", | 380 "%s%shost=%s&page=%d", |
381 overridden_frontend_url_.c_str(), | 381 overridden_frontend_url_.c_str(), |
382 overridden_frontend_url_.find("?") == std::string::npos ? "?" : "&", | 382 overridden_frontend_url_.find("?") == std::string::npos ? "?" : "&", |
383 host.c_str(), | 383 host.c_str(), |
384 i->id); | 384 i->id); |
385 page_info->SetString("devtoolsFrontendUrl", devtools_frontend_url); | 385 page_info->SetString("devtoolsFrontendUrl", devtools_frontend_url); |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 std::string response; | 389 std::string response; |
390 base::JSONWriter::Write(&json_pages_list, true, &response); | 390 base::JSONWriter::WriteWithOptions(&json_pages_list, |
| 391 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 392 &response); |
391 Send200(connection_id, response, "application/json; charset=UTF-8"); | 393 Send200(connection_id, response, "application/json; charset=UTF-8"); |
392 } | 394 } |
393 | 395 |
394 void DevToolsHttpHandlerImpl::OnWebSocketRequestUI( | 396 void DevToolsHttpHandlerImpl::OnWebSocketRequestUI( |
395 int connection_id, | 397 int connection_id, |
396 const net::HttpServerRequestInfo& request) { | 398 const net::HttpServerRequestInfo& request) { |
397 std::string prefix = "/devtools/page/"; | 399 std::string prefix = "/devtools/page/"; |
398 size_t pos = request.path.find(prefix); | 400 size_t pos = request.path.find(prefix); |
399 if (pos != 0) { | 401 if (pos != 0) { |
400 Send404(connection_id); | 402 Send404(connection_id); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 599 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
598 int connection_id, | 600 int connection_id, |
599 const net::HttpServerRequestInfo& request) { | 601 const net::HttpServerRequestInfo& request) { |
600 BrowserThread::PostTask( | 602 BrowserThread::PostTask( |
601 BrowserThread::IO, FROM_HERE, | 603 BrowserThread::IO, FROM_HERE, |
602 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 604 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
603 connection_id, request)); | 605 connection_id, request)); |
604 } | 606 } |
605 | 607 |
606 } // namespace content | 608 } // namespace content |
OLD | NEW |