| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/json/string_escape.h" | 5 #include "base/json/string_escape.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (put_in_quotes) | 75 if (put_in_quotes) |
| 76 dst->push_back('"'); | 76 dst->push_back('"'); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 void JsonDoubleQuote(const std::string& str, | 81 void JsonDoubleQuote(const StringPiece& str, |
| 82 bool put_in_quotes, | 82 bool put_in_quotes, |
| 83 std::string* dst) { | 83 std::string* dst) { |
| 84 JsonDoubleQuoteT(str, put_in_quotes, dst); | 84 JsonDoubleQuoteT(str, put_in_quotes, dst); |
| 85 } | 85 } |
| 86 | 86 |
| 87 std::string GetDoubleQuotedJson(const std::string& str) { | 87 std::string GetDoubleQuotedJson(const StringPiece& str) { |
| 88 std::string dst; | 88 std::string dst; |
| 89 JsonDoubleQuote(str, true, &dst); | 89 JsonDoubleQuote(str, true, &dst); |
| 90 return dst; | 90 return dst; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void JsonDoubleQuote(const string16& str, | 93 void JsonDoubleQuote(const StringPiece16& str, |
| 94 bool put_in_quotes, | 94 bool put_in_quotes, |
| 95 std::string* dst) { | 95 std::string* dst) { |
| 96 JsonDoubleQuoteT(str, put_in_quotes, dst); | 96 JsonDoubleQuoteT(str, put_in_quotes, dst); |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::string GetDoubleQuotedJson(const string16& str) { | 99 std::string GetDoubleQuotedJson(const StringPiece16& str) { |
| 100 std::string dst; | 100 std::string dst; |
| 101 JsonDoubleQuote(str, true, &dst); | 101 JsonDoubleQuote(str, true, &dst); |
| 102 return dst; | 102 return dst; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace base | 105 } // namespace base |
| OLD | NEW |