Roll WebRTC 7546:7549.
[chromium-blink-merge.git] / jingle / notifier / listener / send_ping_task.h
blob5c980ac4e40f8d642093320e591d6256257af5ab
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.
7 #ifndef JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_
8 #define JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_
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"
15 namespace buzz {
16 class XmlElement;
17 } // namespace
19 namespace notifier {
21 class SendPingTask : public buzz::XmppTask {
22 public:
23 class Delegate {
24 public:
25 virtual void OnPingResponseReceived() = 0;
27 protected:
28 virtual ~Delegate();
31 SendPingTask(buzz::XmppTaskParentInterface* parent, Delegate* delegate);
32 ~SendPingTask() override;
34 // Overridden from buzz::XmppTask.
35 int ProcessStart() override;
36 int ProcessResponse() override;
37 bool HandleStanza(const buzz::XmlElement* stanza) override;
39 private:
40 static buzz::XmlElement* MakePingStanza(const std::string& task_id);
42 FRIEND_TEST_ALL_PREFIXES(SendPingTaskTest, MakePingStanza);
44 std::string ping_task_id_;
45 Delegate* delegate_;
47 DISALLOW_COPY_AND_ASSIGN(SendPingTask);
50 typedef SendPingTask::Delegate SendPingTaskDelegate;
52 } // namespace notifier
54 #endif // JINGLE_NOTIFIER_LISTENER_SEND_PING_TASK_H_