Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / client / plugin / delegating_signal_strategy.h
blob94a31908591da04c93041f53e3dfe2697e4f668e
1 // Copyright 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_CLIENT_PLUGIN_DELEGATING_SIGNAL_STRATEGY_H_
6 #define REMOTING_CLIENT_PLUGIN_DELEGATING_SIGNAL_STRATEGY_H_
8 #include "base/callback.h"
9 #include "base/observer_list.h"
10 #include "remoting/signaling/signal_strategy.h"
12 namespace base {
13 class SingleThreadTaskRunner;
14 } // namespace base
16 namespace remoting {
18 class DelegatingSignalStrategy : public SignalStrategy {
19 public:
20 typedef base::Callback<void(const std::string&)> SendIqCallback;
22 DelegatingSignalStrategy(std::string local_jid,
23 const SendIqCallback& send_iq_callback);
24 ~DelegatingSignalStrategy() override;
26 void OnIncomingMessage(const std::string& message);
28 // SignalStrategy interface.
29 void Connect() override;
30 void Disconnect() override;
31 State GetState() const override;
32 Error GetError() const override;
33 std::string GetLocalJid() const override;
34 void AddListener(Listener* listener) override;
35 void RemoveListener(Listener* listener) override;
36 bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override;
37 std::string GetNextId() override;
39 private:
40 std::string local_jid_;
41 SendIqCallback send_iq_callback_;
43 base::ObserverList<Listener> listeners_;
45 DISALLOW_COPY_AND_ASSIGN(DelegatingSignalStrategy);
48 } // namespace remoting
50 #endif // REMOTING_CLIENT_PLUGIN_DELEGATING_SIGNAL_STRATEGY_H_