Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: sync/tools/sync_listen_notifications.cc

Issue 10545170: [Sync] Propagate XMPP auth errors to SyncNotifierObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps, win compile error Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« sync/notifier/chrome_invalidation_client.h ('K') | « sync/sync.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cstdio> 5 #include <cstdio>
6 #include <string> 6 #include <string>
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 20 matching lines...) Expand all
31 // listens to any received notifications. 31 // listens to any received notifications.
32 32
33 namespace { 33 namespace {
34 34
35 // Class to print received notifications events. 35 // Class to print received notifications events.
36 class NotificationPrinter : public sync_notifier::SyncNotifierObserver { 36 class NotificationPrinter : public sync_notifier::SyncNotifierObserver {
37 public: 37 public:
38 NotificationPrinter() {} 38 NotificationPrinter() {}
39 virtual ~NotificationPrinter() {} 39 virtual ~NotificationPrinter() {}
40 40
41 virtual void OnNotificationsEnabled() OVERRIDE {
42 LOG(INFO) << "Notifications enabled";
43 }
44
45 virtual void OnNotificationsDisabled(
46 sync_notifier::NotificationsDisabledReason reason) OVERRIDE {
47 LOG(INFO) << "Notifications disabled with reason "
48 << sync_notifier::NotificationsDisabledReasonToString(reason);
49 }
50
41 virtual void OnIncomingNotification( 51 virtual void OnIncomingNotification(
42 const syncable::ModelTypePayloadMap& type_payloads, 52 const syncable::ModelTypePayloadMap& type_payloads,
43 sync_notifier::IncomingNotificationSource source) OVERRIDE { 53 sync_notifier::IncomingNotificationSource source) OVERRIDE {
44 for (syncable::ModelTypePayloadMap::const_iterator it = 54 for (syncable::ModelTypePayloadMap::const_iterator it =
45 type_payloads.begin(); it != type_payloads.end(); ++it) { 55 type_payloads.begin(); it != type_payloads.end(); ++it) {
46 LOG(INFO) << (source == sync_notifier::REMOTE_NOTIFICATION ? 56 LOG(INFO) << (source == sync_notifier::REMOTE_NOTIFICATION ?
47 "Remote" : "Local") 57 "Remote" : "Local")
48 << " Notification: type = " 58 << " Notification: type = "
49 << syncable::ModelTypeToString(it->first) 59 << syncable::ModelTypeToString(it->first)
50 << ", payload = " << it->second; 60 << ", payload = " << it->second;
51 } 61 }
52 } 62 }
53 63
54 virtual void OnNotificationStateChange(
55 bool notifications_enabled) OVERRIDE {
56 LOG(INFO) << "Notifications enabled: " << notifications_enabled;
57 }
58
59 private: 64 private:
60 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); 65 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter);
61 }; 66 };
62 67
63 class NullInvalidationStateTracker 68 class NullInvalidationStateTracker
64 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, 69 : public base::SupportsWeakPtr<NullInvalidationStateTracker>,
65 public sync_notifier::InvalidationStateTracker { 70 public sync_notifier::InvalidationStateTracker {
66 public: 71 public:
67 NullInvalidationStateTracker() {} 72 NullInvalidationStateTracker() {}
68 virtual ~NullInvalidationStateTracker() {} 73 virtual ~NullInvalidationStateTracker() {}
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 sync_notifier->UpdateCredentials(email, token); 228 sync_notifier->UpdateCredentials(email, token);
224 // Listen for notifications for all known types. 229 // Listen for notifications for all known types.
225 sync_notifier->UpdateEnabledTypes(syncable::ModelTypeSet::All()); 230 sync_notifier->UpdateEnabledTypes(syncable::ModelTypeSet::All());
226 231
227 ui_loop.Run(); 232 ui_loop.Run();
228 233
229 sync_notifier->RemoveObserver(&notification_printer); 234 sync_notifier->RemoveObserver(&notification_printer);
230 io_thread.Stop(); 235 io_thread.Stop();
231 return 0; 236 return 0;
232 } 237 }
OLDNEW
« sync/notifier/chrome_invalidation_client.h ('K') | « sync/sync.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698