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 3 // found in the LICENSE file. 4 5 #ifndef JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_ 6 #define JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_ 7 8 #include "jingle/notifier/listener/notification_defines.h" 9 10 namespace notifier { 11 12 enum NotificationsDisabledReason { 13 // There is an underlying transient problem (e.g., network- or 14 // XMPP-related). 15 TRANSIENT_NOTIFICATION_ERROR, 16 DEFAULT_NOTIFICATION_ERROR = TRANSIENT_NOTIFICATION_ERROR, 17 // Our credentials have been rejected. 18 NOTIFICATION_CREDENTIALS_REJECTED, 19 // No error (useful for avoiding keeping a separate bool for 20 // notifications enabled/disabled). 21 NO_NOTIFICATION_ERROR 22 }; 23 24 // A PushClientObserver is notified when notifications are enabled or 25 // disabled, and when a notification is received. 26 class PushClientObserver { 27 protected: 28 virtual ~PushClientObserver(); 29 30 public: 31 // Called when notifications are enabled. 32 virtual void OnNotificationsEnabled() = 0; 33 34 // Called when notifications are disabled, with the reason (not 35 // equal to NO_ERROR) in |reason|. 36 virtual void OnNotificationsDisabled( 37 NotificationsDisabledReason reason) = 0; 38 39 // Called when a notification is received. The details of the 40 // notification are in |notification|. 41 virtual void OnIncomingNotification(const Notification& notification) = 0; 42 43 // Called when a ping response is received. Default implementation does 44 // nothing. 45 virtual void OnPingResponse(); 46 }; 47 48 } // namespace notifier 49 50 #endif // JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_ 51