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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 MediatorThreadImpl::Logout(); | 59 MediatorThreadImpl::Logout(); |
60 } | 60 } |
61 | 61 |
62 void ServerNotifierThread::SendNotification( | 62 void ServerNotifierThread::SendNotification( |
63 const OutgoingNotificationData& data) { | 63 const OutgoingNotificationData& data) { |
64 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); | 64 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); |
65 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " | 65 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " |
66 "used"; | 66 "used"; |
67 } | 67 } |
68 | 68 |
69 void ServerNotifierThread::OnInvalidate( | 69 void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { |
70 syncable::ModelType model_type, | |
71 const std::string& payload) { | |
72 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 70 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
73 DCHECK_GE(model_type, syncable::FIRST_REAL_MODEL_TYPE); | 71 DCHECK_GE(model_type, syncable::FIRST_REAL_MODEL_TYPE); |
74 DCHECK_LT(model_type, syncable::MODEL_TYPE_COUNT); | 72 DCHECK_LT(model_type, syncable::MODEL_TYPE_COUNT); |
75 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); | 73 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); |
76 | 74 |
77 syncable::ModelTypeBitSet model_types; | 75 syncable::ModelTypeBitSet model_types; |
78 model_types[model_type] = true; | 76 model_types[model_type] = true; |
79 IncomingNotificationData notification_data; | 77 IncomingNotificationData notification_data; |
80 notification_data.service_url = model_types.to_string(); | 78 notification_data.service_specific_data = model_types.to_string(); |
81 notification_data.service_specific_data = payload; | |
82 observers_->Notify(&Observer::OnIncomingNotification, notification_data); | 79 observers_->Notify(&Observer::OnIncomingNotification, notification_data); |
83 } | 80 } |
84 | 81 |
85 void ServerNotifierThread::OnInvalidateAll() { | 82 void ServerNotifierThread::OnInvalidateAll() { |
86 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 83 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
87 VLOG(1) << "OnInvalidateAll"; | 84 VLOG(1) << "OnInvalidateAll"; |
88 | 85 |
89 syncable::ModelTypeBitSet model_types; | 86 syncable::ModelTypeBitSet model_types; |
90 model_types.set(); // InvalidateAll, so set all datatypes to true. | 87 model_types.set(); // InvalidateAll, so set all datatypes to true. |
91 IncomingNotificationData notification_data; | 88 IncomingNotificationData notification_data; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 chrome_invalidation_client_->RegisterTypes(); | 132 chrome_invalidation_client_->RegisterTypes(); |
136 observers_->Notify(&Observer::OnSubscriptionStateChange, true); | 133 observers_->Notify(&Observer::OnSubscriptionStateChange, true); |
137 } | 134 } |
138 | 135 |
139 void ServerNotifierThread::StopInvalidationListener() { | 136 void ServerNotifierThread::StopInvalidationListener() { |
140 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 137 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
141 chrome_invalidation_client_.reset(); | 138 chrome_invalidation_client_.reset(); |
142 } | 139 } |
143 | 140 |
144 } // namespace sync_notifier | 141 } // namespace sync_notifier |
OLD | NEW |