15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "jingle/notifier/listener/notification_defines.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace notifier {
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum NotificationsDisabledReason {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // There is an underlying transient problem (e.g., network- or
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // XMPP-related).
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TRANSIENT_NOTIFICATION_ERROR,
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DEFAULT_NOTIFICATION_ERROR = TRANSIENT_NOTIFICATION_ERROR,
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Our credentials have been rejected.
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NOTIFICATION_CREDENTIALS_REJECTED,
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // No error (useful for avoiding keeping a separate bool for
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notifications enabled/disabled).
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NO_NOTIFICATION_ERROR
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A PushClientObserver is notified when notifications are enabled or
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// disabled, and when a notification is received.
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PushClientObserver {
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~PushClientObserver();
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when notifications are enabled.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnNotificationsEnabled() = 0;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when notifications are disabled, with the reason (not
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // equal to NO_ERROR) in |reason|.
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnNotificationsDisabled(
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      NotificationsDisabledReason reason) = 0;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when a notification is received.  The details of the
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notification are in |notification|.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnIncomingNotification(const Notification& notification) = 0;
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when a ping response is received. Default implementation does
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // nothing.
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnPingResponse();
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace notifier
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_OBSERVER_H_
51