Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: net/base/net_util.cc

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS page encodings Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jingle/notifier/listener/notification_defines.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 241d74859f12d85b96de86b16581748a6e13dfd0..1f69ee71800b5e7ffeb72f841641993aee8dabeb 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1095,7 +1095,7 @@ std::string GetDirectoryListingHeader(const base::string16& title) {
result.assign(header.data(), header.size());
result.append("<script>start(");
- base::JsonDoubleQuote(title, true, &result);
+ base::EscapeJSONString(title, true, &result);
result.append(");</script>\n");
return result;
@@ -1149,13 +1149,12 @@ std::string GetDirectoryListingEntry(const base::string16& name,
Time modified) {
std::string result;
result.append("<script>addRow(");
- base::JsonDoubleQuote(name, true, &result);
+ base::EscapeJSONString(name, true, &result);
result.append(",");
if (raw_bytes.empty()) {
- base::JsonDoubleQuote(EscapePath(UTF16ToUTF8(name)),
- true, &result);
+ base::EscapeJSONString(EscapePath(UTF16ToUTF8(name)), true, &result);
} else {
- base::JsonDoubleQuote(EscapePath(raw_bytes), true, &result);
+ base::EscapeJSONString(EscapePath(raw_bytes), true, &result);
}
if (is_dir) {
result.append(",1,");
@@ -1167,7 +1166,7 @@ std::string GetDirectoryListingEntry(const base::string16& name,
base::string16 size_string;
if (size >= 0)
size_string = FormatBytesUnlocalized(size);
- base::JsonDoubleQuote(size_string, true, &result);
+ base::EscapeJSONString(size_string, true, &result);
result.append(",");
@@ -1176,7 +1175,7 @@ std::string GetDirectoryListingEntry(const base::string16& name,
if (!modified.is_null()) {
modified_str = base::TimeFormatShortDateAndTime(modified);
}
- base::JsonDoubleQuote(modified_str, true, &result);
+ base::EscapeJSONString(modified_str, true, &result);
result.append(");</script>\n");
« no previous file with comments | « jingle/notifier/listener/notification_defines.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698