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 #ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ | 5 #ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ |
6 #define SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ | 6 #define SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | |
10 | |
11 #include "sync/internal_api/public/syncable/model_type_payload_map.h" | 9 #include "sync/internal_api/public/syncable/model_type_payload_map.h" |
| 10 #include "sync/notifier/notifications_disabled_reason.h" |
12 | 11 |
13 namespace sync_notifier { | 12 namespace sync_notifier { |
14 | 13 |
15 enum IncomingNotificationSource { | 14 enum IncomingNotificationSource { |
16 // The server is notifying us that one or more datatypes have stale data. | 15 // The server is notifying us that one or more datatypes have stale data. |
17 REMOTE_NOTIFICATION, | 16 REMOTE_NOTIFICATION, |
18 // A chrome datatype is requesting an optimistic refresh of its data. | 17 // A chrome datatype is requesting an optimistic refresh of its data. |
19 LOCAL_NOTIFICATION, | 18 LOCAL_NOTIFICATION, |
20 }; | 19 }; |
21 | 20 |
22 class SyncNotifierObserver { | 21 class SyncNotifierObserver { |
23 public: | 22 public: |
| 23 // Called when notifications are enabled. |
| 24 virtual void OnNotificationsEnabled() = 0; |
| 25 |
| 26 // Called when notifications are disabled, with the reason in |
| 27 // |reason|. |
| 28 virtual void OnNotificationsDisabled( |
| 29 NotificationsDisabledReason reason) = 0; |
| 30 |
| 31 // Called when a notification is received. The per-type payloads |
| 32 // are in |type_payloads| and the source is in |source|. |
24 virtual void OnIncomingNotification( | 33 virtual void OnIncomingNotification( |
25 const syncable::ModelTypePayloadMap& type_payloads, | 34 const syncable::ModelTypePayloadMap& type_payloads, |
26 IncomingNotificationSource source) = 0; | 35 IncomingNotificationSource source) = 0; |
27 virtual void OnNotificationStateChange(bool notifications_enabled) = 0; | |
28 | 36 |
29 protected: | 37 protected: |
30 virtual ~SyncNotifierObserver() {} | 38 virtual ~SyncNotifierObserver() {} |
31 }; | 39 }; |
32 | 40 |
33 } // namespace sync_notifier | 41 } // namespace sync_notifier |
34 | 42 |
35 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ | 43 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_OBSERVER_H_ |
OLD | NEW |