| 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 13 matching lines...) Expand all Loading... |
| 24 #include "content/browser/devtools/tethering_handler.h" | 24 #include "content/browser/devtools/tethering_handler.h" |
| 25 #include "content/common/devtools_messages.h" | 25 #include "content/common/devtools_messages.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/devtools_agent_host.h" | 27 #include "content/public/browser/devtools_agent_host.h" |
| 28 #include "content/public/browser/devtools_client_host.h" | 28 #include "content/public/browser/devtools_client_host.h" |
| 29 #include "content/public/browser/devtools_http_handler_delegate.h" | 29 #include "content/public/browser/devtools_http_handler_delegate.h" |
| 30 #include "content/public/browser/devtools_manager.h" | 30 #include "content/public/browser/devtools_manager.h" |
| 31 #include "content/public/browser/devtools_target.h" | 31 #include "content/public/browser/devtools_target.h" |
| 32 #include "content/public/common/content_client.h" | 32 #include "content/public/common/content_client.h" |
| 33 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
| 34 #include "content/public/common/user_agent.h" |
| 34 #include "grit/devtools_resources_map.h" | 35 #include "grit/devtools_resources_map.h" |
| 35 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
| 36 #include "net/base/io_buffer.h" | 37 #include "net/base/io_buffer.h" |
| 37 #include "net/base/ip_endpoint.h" | 38 #include "net/base/ip_endpoint.h" |
| 38 #include "net/server/http_server_request_info.h" | 39 #include "net/server/http_server_request_info.h" |
| 39 #include "net/server/http_server_response_info.h" | 40 #include "net/server/http_server_response_info.h" |
| 40 #include "webkit/common/user_agent/user_agent.h" | |
| 41 #include "webkit/common/user_agent/user_agent_util.h" | |
| 42 | 41 |
| 43 #if defined(OS_ANDROID) | 42 #if defined(OS_ANDROID) |
| 44 #include "base/android/build_info.h" | 43 #include "base/android/build_info.h" |
| 45 #endif | 44 #endif |
| 46 | 45 |
| 47 namespace content { | 46 namespace content { |
| 48 | 47 |
| 49 namespace { | 48 namespace { |
| 50 | 49 |
| 51 const char kProtocolVersion[] = "1.0"; | 50 const char kProtocolVersion[] = "1.0"; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 SendJson(connection_id, | 445 SendJson(connection_id, |
| 447 net::HTTP_NOT_FOUND, | 446 net::HTTP_NOT_FOUND, |
| 448 NULL, | 447 NULL, |
| 449 "Malformed query: " + info.path); | 448 "Malformed query: " + info.path); |
| 450 return; | 449 return; |
| 451 } | 450 } |
| 452 | 451 |
| 453 if (command == "version") { | 452 if (command == "version") { |
| 454 base::DictionaryValue version; | 453 base::DictionaryValue version; |
| 455 version.SetString("Protocol-Version", kProtocolVersion); | 454 version.SetString("Protocol-Version", kProtocolVersion); |
| 456 version.SetString("WebKit-Version", webkit_glue::GetWebKitVersion()); | 455 version.SetString("WebKit-Version", GetWebKitVersion()); |
| 457 version.SetString("Browser", content::GetContentClient()->GetProduct()); | 456 version.SetString("Browser", GetContentClient()->GetProduct()); |
| 458 version.SetString("User-Agent", | 457 version.SetString("User-Agent", GetUserAgent(GURL(kAboutBlankURL))); |
| 459 webkit_glue::GetUserAgent(GURL(kAboutBlankURL))); | |
| 460 #if defined(OS_ANDROID) | 458 #if defined(OS_ANDROID) |
| 461 version.SetString("Android-Package", | 459 version.SetString("Android-Package", |
| 462 base::android::BuildInfo::GetInstance()->package_name()); | 460 base::android::BuildInfo::GetInstance()->package_name()); |
| 463 #endif | 461 #endif |
| 464 SendJson(connection_id, net::HTTP_OK, &version, std::string()); | 462 SendJson(connection_id, net::HTTP_OK, &version, std::string()); |
| 465 return; | 463 return; |
| 466 } | 464 } |
| 467 | 465 |
| 468 if (command == "list") { | 466 if (command == "list") { |
| 469 std::string host = info.headers["host"]; | 467 std::string host = info.headers["host"]; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 id.c_str(), | 778 id.c_str(), |
| 781 host); | 779 host); |
| 782 dictionary->SetString( | 780 dictionary->SetString( |
| 783 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 781 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
| 784 } | 782 } |
| 785 | 783 |
| 786 return dictionary; | 784 return dictionary; |
| 787 } | 785 } |
| 788 | 786 |
| 789 } // namespace content | 787 } // namespace content |
| OLD | NEW |