| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/devtools_service/devtools_http_server.h" | 5 #include "components/devtools_service/devtools_http_server.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 DISALLOW_COPY_AND_ASSIGN(HttpConnectionDelegateImpl); | 329 DISALLOW_COPY_AND_ASSIGN(HttpConnectionDelegateImpl); |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 DevToolsHttpServer::DevToolsHttpServer(DevToolsService* service, | 332 DevToolsHttpServer::DevToolsHttpServer(DevToolsService* service, |
| 333 uint16_t remote_debugging_port) | 333 uint16_t remote_debugging_port) |
| 334 : service_(service), remote_debugging_port_(remote_debugging_port) { | 334 : service_(service), remote_debugging_port_(remote_debugging_port) { |
| 335 VLOG(1) << "Remote debugging HTTP server is started on port " | 335 VLOG(1) << "Remote debugging HTTP server is started on port " |
| 336 << remote_debugging_port << "."; | 336 << remote_debugging_port << "."; |
| 337 mojo::NetworkServicePtr network_service; | 337 mojo::NetworkServicePtr network_service; |
| 338 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 338 service_->application()->ConnectToService("mojo:network_service", |
| 339 request->url = "mojo:network_service"; | 339 &network_service); |
| 340 service_->application()->ConnectToService(request.Pass(), &network_service); | |
| 341 | 340 |
| 342 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); | 341 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); |
| 343 local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4; | 342 local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4; |
| 344 local_address->ipv4 = mojo::NetAddressIPv4::New(); | 343 local_address->ipv4 = mojo::NetAddressIPv4::New(); |
| 345 local_address->ipv4->port = remote_debugging_port; | 344 local_address->ipv4->port = remote_debugging_port; |
| 346 local_address->ipv4->addr.resize(4); | 345 local_address->ipv4->addr.resize(4); |
| 347 local_address->ipv4->addr[0] = 127; | 346 local_address->ipv4->addr[0] = 127; |
| 348 local_address->ipv4->addr[1] = 0; | 347 local_address->ipv4->addr[1] = 0; |
| 349 local_address->ipv4->addr[2] = 0; | 348 local_address->ipv4->addr[2] = 0; |
| 350 local_address->ipv4->addr[3] = 1; | 349 local_address->ipv4->addr[3] = 1; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 iter.value()->id().c_str())); | 491 iter.value()->id().c_str())); |
| 493 list_value.Append(dict_value.Pass()); | 492 list_value.Append(dict_value.Pass()); |
| 494 } | 493 } |
| 495 return MakeJsonResponse(200, &list_value, std::string()); | 494 return MakeJsonResponse(200, &list_value, std::string()); |
| 496 } | 495 } |
| 497 | 496 |
| 498 return MakeJsonResponse(404, nullptr, "Unknown command: " + command); | 497 return MakeJsonResponse(404, nullptr, "Unknown command: " + command); |
| 499 } | 498 } |
| 500 | 499 |
| 501 } // namespace devtools_service | 500 } // namespace devtools_service |
| OLD | NEW |