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 virtual ~HostChangeNotificationListener();
42 // SignalStrategy::Listener interface.
43 virtual void OnSignalStrategyStateChange(
44 SignalStrategy::State state) OVERRIDE;
45 virtual bool OnSignalStrategyIncomingStanza(
46 const buzz::XmlElement* stanza) OVERRIDE;
53 SignalStrategy* signal_strategy_;
54 std::string directory_bot_jid_;
55 base::WeakPtrFactory<HostChangeNotificationListener> weak_factory_;
56 DISALLOW_COPY_AND_ASSIGN(HostChangeNotificationListener);
59 } // namespace remoting
61 #endif // REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H