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

Unified Diff: jingle/notifier/listener/notification_defines.cc

Issue 10828264: Clean up logging for push_notifications_*.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 months 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 | « no previous file | jingle/notifier/listener/push_notifications_listen_task.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 2f65775d44ff223c1cd676c8db47fb3e347621b4..f496df19863b99f22afbb83e649fde10a7542617 100644
--- a/jingle/notifier/listener/notification_defines.cc
+++ b/jingle/notifier/listener/notification_defines.cc
@@ -6,6 +6,11 @@
#include <cstddef>
+#include "base/json/json_writer.h"
+#include "base/logging.h"
+#include "base/string_util.h"
+#include "base/values.h"
+
namespace notifier {
Subscription::Subscription() {}
@@ -60,7 +65,14 @@ bool Notification::Equals(const Notification& other) const {
}
std::string Notification::ToString() const {
- return "{ channel: \"" + channel + "\", data: \"" + data + "\" }";
+ // Put into a DictionaryValue and convert to a string; this gives a
+ // nice hex-encoding of |data|, which may be a binary string.
+ DictionaryValue dict;
+ dict.SetString("channel", channel);
+ dict.SetString("data", data);
+ std::string str;
+ base::JSONWriter::Write(&dict, &str);
+ return str;
}
} // namespace notifier
« no previous file with comments | « no previous file | jingle/notifier/listener/push_notifications_listen_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698