| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "net/base/ip_endpoint.h" | 45 #include "net/base/ip_endpoint.h" |
| 46 #include "net/server/http_server_request_info.h" | 46 #include "net/server/http_server_request_info.h" |
| 47 #include "net/server/http_server_response_info.h" | 47 #include "net/server/http_server_response_info.h" |
| 48 #include "ui/base/layout.h" | 48 #include "ui/base/layout.h" |
| 49 #include "url/gurl.h" | 49 #include "url/gurl.h" |
| 50 #include "webkit/common/user_agent/user_agent.h" | 50 #include "webkit/common/user_agent/user_agent.h" |
| 51 #include "webkit/common/user_agent/user_agent_util.h" | 51 #include "webkit/common/user_agent/user_agent_util.h" |
| 52 | 52 |
| 53 namespace content { | 53 namespace content { |
| 54 | 54 |
| 55 const int kBufferSize = 16 * 1024; | |
| 56 | |
| 57 namespace { | 55 namespace { |
| 58 | 56 |
| 59 static const char* kProtocolVersion = "1.0"; | 57 const char kProtocolVersion[] = "1.0"; |
| 60 | 58 |
| 61 static const char* kDevToolsHandlerThreadName = "Chrome_DevToolsHandlerThread"; | 59 const char kDevToolsHandlerThreadName[] = "Chrome_DevToolsHandlerThread"; |
| 62 | 60 |
| 63 static const char* kThumbUrlPrefix = "/thumb/"; | 61 const char kThumbUrlPrefix[] = "/thumb/"; |
| 64 static const char* kPageUrlPrefix = "/devtools/page/"; | 62 const char kPageUrlPrefix[] = "/devtools/page/"; |
| 65 | 63 |
| 66 static const char* kTargetIdField = "id"; | 64 const char kTargetIdField[] = "id"; |
| 67 static const char* kTargetTypeField = "type"; | 65 const char kTargetTypeField[] = "type"; |
| 68 static const char* kTargetTitleField = "title"; | 66 const char kTargetTitleField[] = "title"; |
| 69 static const char* kTargetDescriptionField = "description"; | 67 const char kTargetDescriptionField[] = "description"; |
| 70 static const char* kTargetUrlField = "url"; | 68 const char kTargetUrlField[] = "url"; |
| 71 static const char* kTargetThumbnailUrlField = "thumbnailUrl"; | 69 const char kTargetThumbnailUrlField[] = "thumbnailUrl"; |
| 72 static const char* kTargetFaviconUrlField = "faviconUrl"; | 70 const char kTargetFaviconUrlField[] = "faviconUrl"; |
| 73 static const char* kTargetWebSocketDebuggerUrlField = "webSocketDebuggerUrl"; | 71 const char kTargetWebSocketDebuggerUrlField[] = "webSocketDebuggerUrl"; |
| 74 static const char* kTargetDevtoolsFrontendUrlField = "devtoolsFrontendUrl"; | 72 const char kTargetDevtoolsFrontendUrlField[] = "devtoolsFrontendUrl"; |
| 75 | 73 |
| 76 static const char* kTargetTypePage = "page"; | 74 const char kTargetTypePage[] = "page"; |
| 77 static const char* kTargetTypeOther = "other"; | 75 const char kTargetTypeOther[] = "other"; |
| 78 | 76 |
| 79 class DevToolsDefaultBindingHandler | 77 class DevToolsDefaultBindingHandler |
| 80 : public DevToolsHttpHandler::DevToolsAgentHostBinding { | 78 : public DevToolsHttpHandler::DevToolsAgentHostBinding { |
| 81 public: | 79 public: |
| 82 DevToolsDefaultBindingHandler() { | 80 DevToolsDefaultBindingHandler() { |
| 83 } | 81 } |
| 84 | 82 |
| 85 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) OVERRIDE { | 83 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) OVERRIDE { |
| 86 return agent_host->GetId(); | 84 return agent_host->GetId(); |
| 87 } | 85 } |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 host.c_str(), | 860 host.c_str(), |
| 863 kPageUrlPrefix, | 861 kPageUrlPrefix, |
| 864 id.c_str())); | 862 id.c_str())); |
| 865 std::string devtools_frontend_url = GetFrontendURLInternal( | 863 std::string devtools_frontend_url = GetFrontendURLInternal( |
| 866 id.c_str(), | 864 id.c_str(), |
| 867 host); | 865 host); |
| 868 dictionary->SetString(kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 866 dictionary->SetString(kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
| 869 } | 867 } |
| 870 | 868 |
| 871 } // namespace content | 869 } // namespace content |
| OLD | NEW |