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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | jingle/notifier/listener/push_notifications_listen_task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "jingle/notifier/listener/notification_defines.h" 5 #include "jingle/notifier/listener/notification_defines.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/json/json_writer.h"
10 #include "base/logging.h"
11 #include "base/string_util.h"
12 #include "base/values.h"
13
9 namespace notifier { 14 namespace notifier {
10 15
11 Subscription::Subscription() {} 16 Subscription::Subscription() {}
12 Subscription::~Subscription() {} 17 Subscription::~Subscription() {}
13 18
14 bool Subscription::Equals(const Subscription& other) const { 19 bool Subscription::Equals(const Subscription& other) const {
15 return channel == other.channel && from == other.from; 20 return channel == other.channel && from == other.from;
16 } 21 }
17 22
18 namespace { 23 namespace {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 Notification::~Notification() {} 58 Notification::~Notification() {}
54 59
55 bool Notification::Equals(const Notification& other) const { 60 bool Notification::Equals(const Notification& other) const {
56 return 61 return
57 channel == other.channel && 62 channel == other.channel &&
58 data == other.data && 63 data == other.data &&
59 RecipientListsEqual(recipients, other.recipients); 64 RecipientListsEqual(recipients, other.recipients);
60 } 65 }
61 66
62 std::string Notification::ToString() const { 67 std::string Notification::ToString() const {
63 return "{ channel: \"" + channel + "\", data: \"" + data + "\" }"; 68 // Put into a DictionaryValue and convert to a string; this gives a
69 // nice hex-encoding of |data|, which may be a binary string.
70 DictionaryValue dict;
71 dict.SetString("channel", channel);
72 dict.SetString("data", data);
73 std::string str;
74 base::JSONWriter::Write(&dict, &str);
75 return str;
64 } 76 }
65 77
66 } // namespace notifier 78 } // namespace notifier
OLDNEW
« 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