| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/string_util.h" | |
| 6 #include "chrome/browser/debugger/devtools_remote_message.h" | 5 #include "chrome/browser/debugger/devtools_remote_message.h" |
| 7 | 6 |
| 7 #include "base/string_number_conversions.h" |
| 8 |
| 8 const char DevToolsRemoteMessageHeaders::kContentLength[] = "Content-Length"; | 9 const char DevToolsRemoteMessageHeaders::kContentLength[] = "Content-Length"; |
| 9 const char DevToolsRemoteMessageHeaders::kTool[] = "Tool"; | 10 const char DevToolsRemoteMessageHeaders::kTool[] = "Tool"; |
| 10 const char DevToolsRemoteMessageHeaders::kDestination[] = "Destination"; | 11 const char DevToolsRemoteMessageHeaders::kDestination[] = "Destination"; |
| 11 | 12 |
| 12 const char DevToolsRemoteMessage::kEmptyValue[] = ""; | 13 const char DevToolsRemoteMessage::kEmptyValue[] = ""; |
| 13 | 14 |
| 14 DevToolsRemoteMessageBuilder& DevToolsRemoteMessageBuilder::instance() { | 15 DevToolsRemoteMessageBuilder& DevToolsRemoteMessageBuilder::instance() { |
| 15 static DevToolsRemoteMessageBuilder instance_; | 16 static DevToolsRemoteMessageBuilder instance_; |
| 16 return instance_; | 17 return instance_; |
| 17 } | 18 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 40 result.append("\r\n").append(content_); | 41 result.append("\r\n").append(content_); |
| 41 return result; | 42 return result; |
| 42 } | 43 } |
| 43 | 44 |
| 44 DevToolsRemoteMessage* DevToolsRemoteMessageBuilder::Create( | 45 DevToolsRemoteMessage* DevToolsRemoteMessageBuilder::Create( |
| 45 const std::string& tool, | 46 const std::string& tool, |
| 46 const std::string& destination, | 47 const std::string& destination, |
| 47 const std::string& content) { | 48 const std::string& content) { |
| 48 DevToolsRemoteMessage::HeaderMap headers; | 49 DevToolsRemoteMessage::HeaderMap headers; |
| 49 headers[DevToolsRemoteMessageHeaders::kContentLength] = | 50 headers[DevToolsRemoteMessageHeaders::kContentLength] = |
| 50 IntToString(content.size()); | 51 base::IntToString(content.size()); |
| 51 headers[DevToolsRemoteMessageHeaders::kTool] = tool; | 52 headers[DevToolsRemoteMessageHeaders::kTool] = tool; |
| 52 headers[DevToolsRemoteMessageHeaders::kDestination] = destination; | 53 headers[DevToolsRemoteMessageHeaders::kDestination] = destination; |
| 53 return new DevToolsRemoteMessage(headers, content); | 54 return new DevToolsRemoteMessage(headers, content); |
| 54 } | 55 } |
| OLD | NEW |