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 <cstddef> |
5 #include <cstdio> | 6 #include <cstdio> |
6 #include <string> | 7 #include <string> |
7 | 8 |
8 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
9 #include "base/base64.h" | 10 #include "base/base64.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 SyncNotifierFactory sync_notifier_factory( | 236 SyncNotifierFactory sync_notifier_factory( |
236 notifier_options, kClientInfo, | 237 notifier_options, kClientInfo, |
237 null_invalidation_state_tracker.AsWeakPtr()); | 238 null_invalidation_state_tracker.AsWeakPtr()); |
238 scoped_ptr<SyncNotifier> sync_notifier( | 239 scoped_ptr<SyncNotifier> sync_notifier( |
239 sync_notifier_factory.CreateSyncNotifier()); | 240 sync_notifier_factory.CreateSyncNotifier()); |
240 NotificationPrinter notification_printer; | 241 NotificationPrinter notification_printer; |
241 | 242 |
242 const char kUniqueId[] = "fake_unique_id"; | 243 const char kUniqueId[] = "fake_unique_id"; |
243 sync_notifier->SetUniqueId(kUniqueId); | 244 sync_notifier->SetUniqueId(kUniqueId); |
244 sync_notifier->UpdateCredentials(email, token); | 245 sync_notifier->UpdateCredentials(email, token); |
| 246 |
245 // Listen for notifications for all known types. | 247 // Listen for notifications for all known types. |
| 248 const char kHandlerName[] = "sync_listen_notifications"; |
| 249 sync_notifier->SetHandler(kHandlerName, ¬ification_printer); |
246 sync_notifier->UpdateRegisteredIds( | 250 sync_notifier->UpdateRegisteredIds( |
247 ¬ification_printer, ModelTypeSetToObjectIdSet(ModelTypeSet::All())); | 251 kHandlerName, ModelTypeSetToObjectIdSet(ModelTypeSet::All())); |
248 | 252 |
249 ui_loop.Run(); | 253 ui_loop.Run(); |
250 | 254 |
251 sync_notifier->UpdateRegisteredIds(¬ification_printer, ObjectIdSet()); | 255 sync_notifier->SetHandler(kHandlerName, NULL); |
252 io_thread.Stop(); | 256 io_thread.Stop(); |
253 return 0; | 257 return 0; |
254 } | 258 } |
255 | 259 |
256 } // namespace | 260 } // namespace |
257 } // namespace syncer | 261 } // namespace syncer |
258 | 262 |
259 int main(int argc, char* argv[]) { | 263 int main(int argc, char* argv[]) { |
260 return syncer::SyncListenNotificationsMain(argc, argv); | 264 return syncer::SyncListenNotificationsMain(argc, argv); |
261 } | 265 } |
OLD | NEW |