| 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/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 bool Recipient::Equals(const Recipient& other) const { | 48 bool Recipient::Equals(const Recipient& other) const { |
| 49 return to == other.to && user_specific_data == other.user_specific_data; | 49 return to == other.to && user_specific_data == other.user_specific_data; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool RecipientListsEqual(const RecipientList& recipients1, | 52 bool RecipientListsEqual(const RecipientList& recipients1, |
| 53 const RecipientList& recipients2) { | 53 const RecipientList& recipients2) { |
| 54 return ListsEqual(recipients1, recipients2); | 54 return ListsEqual(recipients1, recipients2); |
| 55 } | 55 } |
| 56 | 56 |
| 57 Notification::Notification() {} | 57 Notification::Notification() : ping(false) {} |
| 58 Notification::~Notification() {} | 58 Notification::~Notification() {} |
| 59 | 59 |
| 60 bool Notification::Equals(const Notification& other) const { | 60 bool Notification::Equals(const Notification& other) const { |
| 61 return | 61 return |
| 62 channel == other.channel && | 62 channel == other.channel && |
| 63 data == other.data && | 63 data == other.data && |
| 64 RecipientListsEqual(recipients, other.recipients); | 64 RecipientListsEqual(recipients, other.recipients); |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::string Notification::ToString() const { | 67 std::string Notification::ToString() const { |
| 68 // |channel| or |data| could hold binary data, so use GetDoubleQuotedJson() | 68 // |channel| or |data| could hold binary data, so use GetDoubleQuotedJson() |
| 69 // to escape them. | 69 // to escape them. |
| 70 const std::string& printable_channel = base::GetDoubleQuotedJson(channel); | 70 const std::string& printable_channel = base::GetDoubleQuotedJson(channel); |
| 71 const std::string& printable_data = base::GetDoubleQuotedJson(data); | 71 const std::string& printable_data = base::GetDoubleQuotedJson(data); |
| 72 return | 72 return |
| 73 "{ channel: " + printable_channel + ", data: " + printable_data + " }"; | 73 "{ channel: " + printable_channel + ", data: " + printable_data + " }"; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace notifier | 76 } // namespace notifier |
| OLD | NEW |