Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/base64.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "base/string_util.h" | |
| 12 | |
| 9 namespace notifier { | 13 namespace notifier { |
| 10 | 14 |
| 11 Subscription::Subscription() {} | 15 Subscription::Subscription() {} |
| 12 Subscription::~Subscription() {} | 16 Subscription::~Subscription() {} |
| 13 | 17 |
| 14 bool Subscription::Equals(const Subscription& other) const { | 18 bool Subscription::Equals(const Subscription& other) const { |
| 15 return channel == other.channel && from == other.from; | 19 return channel == other.channel && from == other.from; |
| 16 } | 20 } |
| 17 | 21 |
| 18 namespace { | 22 namespace { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 Notification::~Notification() {} | 57 Notification::~Notification() {} |
| 54 | 58 |
| 55 bool Notification::Equals(const Notification& other) const { | 59 bool Notification::Equals(const Notification& other) const { |
| 56 return | 60 return |
| 57 channel == other.channel && | 61 channel == other.channel && |
| 58 data == other.data && | 62 data == other.data && |
| 59 RecipientListsEqual(recipients, other.recipients); | 63 RecipientListsEqual(recipients, other.recipients); |
| 60 } | 64 } |
| 61 | 65 |
| 62 std::string Notification::ToString() const { | 66 std::string Notification::ToString() const { |
| 63 return "{ channel: \"" + channel + "\", data: \"" + data + "\" }"; | 67 std::string printable_data; |
| 68 if (IsStringASCII(data)) { | |
| 69 printable_data = data; | |
| 70 } else { | |
| 71 CHECK(base::Base64Encode(data, &printable_data)); | |
|
rlarocque
2012/08/10 20:58:38
If this is supposed to be semi-human-readable bina
akalin
2012/08/13 20:24:15
Done.
| |
| 72 } | |
| 73 return "{ channel: \"" + channel + "\", data: \"" + printable_data + "\" }"; | |
| 64 } | 74 } |
| 65 | 75 |
| 66 } // namespace notifier | 76 } // namespace notifier |
| OLD | NEW |