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

Unified Diff: jingle/notifier/listener/notification_defines.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 | « components/plugins/renderer/plugin_placeholder.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/listener/notification_defines.cc
diff --git a/jingle/notifier/listener/notification_defines.cc b/jingle/notifier/listener/notification_defines.cc
index f4f3e408a5b795f8fa80826cdae43158d9479706..f7c8f8fd3ad5dd8fe90af742720f7a6c137efb87 100644
--- a/jingle/notifier/listener/notification_defines.cc
+++ b/jingle/notifier/listener/notification_defines.cc
@@ -65,10 +65,12 @@ bool Notification::Equals(const Notification& other) const {
}
std::string Notification::ToString() const {
- // |channel| or |data| could hold binary data, so use GetDoubleQuotedJson()
- // to escape them.
- const std::string& printable_channel = base::GetDoubleQuotedJson(channel);
- const std::string& printable_data = base::GetDoubleQuotedJson(data);
+ // |channel| or |data| could hold binary data, so convert all non-ASCII
+ // characters to escape sequences.
+ const std::string& printable_channel =
+ base::EscapeBytesAsInvalidJSONString(channel, true /* put_in_quotes */);
+ const std::string& printable_data =
+ base::EscapeBytesAsInvalidJSONString(data, true /* put_in_quotes */);
return
"{ channel: " + printable_channel + ", data: " + printable_data + " }";
}
« no previous file with comments | « components/plugins/renderer/plugin_placeholder.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698