| 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/devtools/devtools_http_handler_impl.h" | 5 #include "content/browser/devtools/devtools_http_handler_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
| 34 #include "grit/devtools_resources_map.h" | 34 #include "grit/devtools_resources_map.h" |
| 35 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
| 36 #include "net/base/io_buffer.h" | 36 #include "net/base/io_buffer.h" |
| 37 #include "net/base/ip_endpoint.h" | 37 #include "net/base/ip_endpoint.h" |
| 38 #include "net/server/http_server_request_info.h" | 38 #include "net/server/http_server_request_info.h" |
| 39 #include "net/server/http_server_response_info.h" | 39 #include "net/server/http_server_response_info.h" |
| 40 #include "webkit/common/user_agent/user_agent.h" | 40 #include "webkit/common/user_agent/user_agent.h" |
| 41 #include "webkit/common/user_agent/user_agent_util.h" | 41 #include "webkit/common/user_agent/user_agent_util.h" |
| 42 | 42 |
| 43 #if defined(OS_ANDROID) |
| 44 #include "base/android/build_info.h" |
| 45 #endif |
| 46 |
| 43 namespace content { | 47 namespace content { |
| 44 | 48 |
| 45 namespace { | 49 namespace { |
| 46 | 50 |
| 47 const char kProtocolVersion[] = "1.0"; | 51 const char kProtocolVersion[] = "1.0"; |
| 48 | 52 |
| 49 const char kDevToolsHandlerThreadName[] = "Chrome_DevToolsHandlerThread"; | 53 const char kDevToolsHandlerThreadName[] = "Chrome_DevToolsHandlerThread"; |
| 50 | 54 |
| 51 const char kThumbUrlPrefix[] = "/thumb/"; | 55 const char kThumbUrlPrefix[] = "/thumb/"; |
| 52 const char kPageUrlPrefix[] = "/devtools/page/"; | 56 const char kPageUrlPrefix[] = "/devtools/page/"; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 return; | 450 return; |
| 447 } | 451 } |
| 448 | 452 |
| 449 if (command == "version") { | 453 if (command == "version") { |
| 450 base::DictionaryValue version; | 454 base::DictionaryValue version; |
| 451 version.SetString("Protocol-Version", kProtocolVersion); | 455 version.SetString("Protocol-Version", kProtocolVersion); |
| 452 version.SetString("WebKit-Version", webkit_glue::GetWebKitVersion()); | 456 version.SetString("WebKit-Version", webkit_glue::GetWebKitVersion()); |
| 453 version.SetString("Browser", content::GetContentClient()->GetProduct()); | 457 version.SetString("Browser", content::GetContentClient()->GetProduct()); |
| 454 version.SetString("User-Agent", | 458 version.SetString("User-Agent", |
| 455 webkit_glue::GetUserAgent(GURL(kAboutBlankURL))); | 459 webkit_glue::GetUserAgent(GURL(kAboutBlankURL))); |
| 460 #if defined(OS_ANDROID) |
| 461 version.SetString("Android-Package", |
| 462 base::android::BuildInfo::GetInstance()->package_name()); |
| 463 #endif |
| 456 SendJson(connection_id, net::HTTP_OK, &version, std::string()); | 464 SendJson(connection_id, net::HTTP_OK, &version, std::string()); |
| 457 return; | 465 return; |
| 458 } | 466 } |
| 459 | 467 |
| 460 if (command == "list") { | 468 if (command == "list") { |
| 461 std::string host = info.headers["host"]; | 469 std::string host = info.headers["host"]; |
| 462 AddRef(); // Balanced in OnTargetListReceived. | 470 AddRef(); // Balanced in OnTargetListReceived. |
| 463 delegate_->EnumerateTargets( | 471 delegate_->EnumerateTargets( |
| 464 base::Bind(&DevToolsHttpHandlerImpl::OnTargetListReceived, | 472 base::Bind(&DevToolsHttpHandlerImpl::OnTargetListReceived, |
| 465 this, connection_id, host)); | 473 this, connection_id, host)); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 id.c_str(), | 780 id.c_str(), |
| 773 host); | 781 host); |
| 774 dictionary->SetString( | 782 dictionary->SetString( |
| 775 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 783 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
| 776 } | 784 } |
| 777 | 785 |
| 778 return dictionary; | 786 return dictionary; |
| 779 } | 787 } |
| 780 | 788 |
| 781 } // namespace content | 789 } // namespace content |
| OLD | NEW |