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 "sync/notifier/p2p_notifier.h" | 5 #include "sync/notifier/p2p_notifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 void P2PNotifier::SendNotificationDataForTest( | 275 void P2PNotifier::SendNotificationDataForTest( |
276 const P2PNotificationData& notification_data) { | 276 const P2PNotificationData& notification_data) { |
277 DCHECK(thread_checker_.CalledOnValidThread()); | 277 DCHECK(thread_checker_.CalledOnValidThread()); |
278 SendNotificationData(notification_data); | 278 SendNotificationData(notification_data); |
279 } | 279 } |
280 | 280 |
281 void P2PNotifier::SendNotificationData( | 281 void P2PNotifier::SendNotificationData( |
282 const P2PNotificationData& notification_data) { | 282 const P2PNotificationData& notification_data) { |
283 DCHECK(thread_checker_.CalledOnValidThread()); | 283 DCHECK(thread_checker_.CalledOnValidThread()); |
| 284 if (notification_data.GetChangedTypes().Empty()) { |
| 285 DVLOG(1) << "Not sending XMPP notification with no changed types: " |
| 286 << notification_data.ToString(); |
| 287 return; |
| 288 } |
284 notifier::Notification notification; | 289 notifier::Notification notification; |
285 notification.channel = kSyncP2PNotificationChannel; | 290 notification.channel = kSyncP2PNotificationChannel; |
286 notification.data = notification_data.ToString(); | 291 notification.data = notification_data.ToString(); |
287 DVLOG(1) << "Sending XMPP notification: " << notification.ToString(); | 292 DVLOG(1) << "Sending XMPP notification: " << notification.ToString(); |
288 push_client_->SendNotification(notification); | 293 push_client_->SendNotification(notification); |
289 } | 294 } |
290 | 295 |
291 } // namespace syncer | 296 } // namespace syncer |
OLD | NEW |