OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/notifier/server_notifier_thread.h" | 5 #include "chrome/browser/sync/notifier/server_notifier_thread.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 MediatorThreadImpl::Logout(); | 57 MediatorThreadImpl::Logout(); |
58 } | 58 } |
59 | 59 |
60 void ServerNotifierThread::SendNotification( | 60 void ServerNotifierThread::SendNotification( |
61 const OutgoingNotificationData& data) { | 61 const OutgoingNotificationData& data) { |
62 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); | 62 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); |
63 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " | 63 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " |
64 "used"; | 64 "used"; |
65 } | 65 } |
66 | 66 |
67 void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { | 67 void ServerNotifierThread::OnInvalidate( |
| 68 syncable::ModelType model_type, |
| 69 const std::string& payload) { |
68 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 70 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
69 DCHECK_GE(model_type, syncable::FIRST_REAL_MODEL_TYPE); | 71 DCHECK_GE(model_type, syncable::FIRST_REAL_MODEL_TYPE); |
70 DCHECK_LT(model_type, syncable::MODEL_TYPE_COUNT); | 72 DCHECK_LT(model_type, syncable::MODEL_TYPE_COUNT); |
71 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); | 73 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); |
72 | 74 |
73 syncable::ModelTypeBitSet model_types; | 75 syncable::ModelTypeBitSet model_types; |
74 model_types[model_type] = true; | 76 model_types[model_type] = true; |
75 IncomingNotificationData notification_data; | 77 IncomingNotificationData notification_data; |
76 notification_data.service_specific_data = model_types.to_string(); | 78 notification_data.service_url = model_types.to_string(); |
| 79 notification_data.service_specific_data = payload; |
77 observers_->Notify(&Observer::OnIncomingNotification, notification_data); | 80 observers_->Notify(&Observer::OnIncomingNotification, notification_data); |
78 } | 81 } |
79 | 82 |
80 void ServerNotifierThread::OnInvalidateAll() { | 83 void ServerNotifierThread::OnInvalidateAll() { |
81 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 84 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
82 VLOG(1) << "OnInvalidateAll"; | 85 VLOG(1) << "OnInvalidateAll"; |
83 | 86 |
84 syncable::ModelTypeBitSet model_types; | 87 syncable::ModelTypeBitSet model_types; |
85 model_types.set(); // InvalidateAll, so set all datatypes to true. | 88 model_types.set(); // InvalidateAll, so set all datatypes to true. |
86 IncomingNotificationData notification_data; | 89 IncomingNotificationData notification_data; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 chrome_invalidation_client_->RegisterTypes(); | 130 chrome_invalidation_client_->RegisterTypes(); |
128 observers_->Notify(&Observer::OnSubscriptionStateChange, true); | 131 observers_->Notify(&Observer::OnSubscriptionStateChange, true); |
129 } | 132 } |
130 | 133 |
131 void ServerNotifierThread::StopInvalidationListener() { | 134 void ServerNotifierThread::StopInvalidationListener() { |
132 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 135 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
133 chrome_invalidation_client_.reset(); | 136 chrome_invalidation_client_.reset(); |
134 } | 137 } |
135 | 138 |
136 } // namespace sync_notifier | 139 } // namespace sync_notifier |
OLD | NEW |