Home | History | Annotate | Download | only in listener
      1 // Copyright (c) 2011 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 // Methods for sending the update stanza to notify peers via xmpp.
      6 
      7 #ifndef JINGLE_NOTIFIER_LISTENER_PUSH_NOTIFICATIONS_SEND_UPDATE_TASK_H_
      8 #define JINGLE_NOTIFIER_LISTENER_PUSH_NOTIFICATIONS_SEND_UPDATE_TASK_H_
      9 
     10 #include "base/basictypes.h"
     11 #include "base/compiler_specific.h"
     12 #include "base/gtest_prod_util.h"
     13 #include "jingle/notifier/listener/notification_defines.h"
     14 #include "talk/xmpp/xmpptask.h"
     15 
     16 namespace buzz {
     17 class Jid;
     18 class XmlElement;
     19 }  // namespace
     20 
     21 namespace notifier {
     22 
     23 class PushNotificationsSendUpdateTask : public buzz::XmppTask {
     24  public:
     25   PushNotificationsSendUpdateTask(
     26       buzz::XmppTaskParentInterface* parent, const Notification& notification);
     27   virtual ~PushNotificationsSendUpdateTask();
     28 
     29   // Overridden from buzz::XmppTask.
     30   virtual int ProcessStart() OVERRIDE;
     31 
     32  private:
     33   // Allocates and constructs an buzz::XmlElement containing the update stanza.
     34   static buzz::XmlElement* MakeUpdateMessage(
     35       const Notification& notification, const buzz::Jid& to_jid_bare);
     36 
     37   const Notification notification_;
     38 
     39   FRIEND_TEST_ALL_PREFIXES(PushNotificationsSendUpdateTaskTest,
     40                            MakeUpdateMessage);
     41 
     42   DISALLOW_COPY_AND_ASSIGN(PushNotificationsSendUpdateTask);
     43 };
     44 
     45 }  // namespace notifier
     46 
     47 #endif  // JINGLE_NOTIFIER_LISTENER_PUSH_NOTIFICATIONS_SEND_UPDATE_TASK_H_
     48