Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / jingle / notifier / listener / send_ping_task.h
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 // Methods for sending the update stanza to notify peers via xmpp.
6
7 #ifndef JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_
8 #define JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "webrtc/libjingle/xmpp/xmpptask.h"
14
15 namespace buzz {
16 class XmlElement;
17 }  // namespace
18
19 namespace notifier {
20
21 class SendPingTask : public buzz::XmppTask {
22  public:
23   class Delegate {
24    public:
25     virtual void OnPingResponseReceived() = 0;
26
27    protected:
28     virtual ~Delegate();
29   };
30
31   SendPingTask(buzz::XmppTaskParentInterface* parent, Delegate* delegate);
32   ~SendPingTask() override;
33
34   // Overridden from buzz::XmppTask.
35   int ProcessStart() override;
36   int ProcessResponse() override;
37   bool HandleStanza(const buzz::XmlElement* stanza) override;
38
39  private:
40   static buzz::XmlElement* MakePingStanza(const std::string& task_id);
41
42   FRIEND_TEST_ALL_PREFIXES(SendPingTaskTest, MakePingStanza);
43
44   std::string ping_task_id_;
45   Delegate* delegate_;
46
47   DISALLOW_COPY_AND_ASSIGN(SendPingTask);
48 };
49
50 typedef SendPingTask::Delegate SendPingTaskDelegate;
51
52 }  // namespace notifier
53
54 #endif  // JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_