1 // Copyright (c) 2013 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.
5 #ifndef REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H
6 #define REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "remoting/signaling/signal_strategy.h"
21 // HostChangeNotificationListener listens for messages from the remoting bot
22 // indicating that its host entry has been changed in the directory.
23 // If a message is received indicating that the host was deleted, it uses the
24 // OnHostDeleted callback to shut down the host.
25 class HostChangeNotificationListener : public SignalStrategy::Listener {
29 virtual ~Listener() {}
30 // Invoked when a notification that the host was deleted is received.
32 virtual void OnHostDeleted() = 0;
35 // Both listener and signal_strategy are expected to outlive this object.
36 HostChangeNotificationListener(Listener* listener,
37 const std::string& host_id,
38 SignalStrategy* signal_strategy,
39 const std::string& directory_bot_jid);
40 ~HostChangeNotificationListener() override;
42 // SignalStrategy::Listener interface.
43 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
44 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
51 SignalStrategy* signal_strategy_;
52 std::string directory_bot_jid_;
53 base::WeakPtrFactory<HostChangeNotificationListener> weak_factory_;
54 DISALLOW_COPY_AND_ASSIGN(HostChangeNotificationListener);
57 } // namespace remoting
59 #endif // REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H