| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ |
| 6 #define REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ | 6 #define REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ |
| 7 | 7 |
| 8 #include "remoting/jingle_glue/signal_strategy.h" | 8 #include "remoting/jingle_glue/signal_strategy.h" |
| 9 | 9 |
| 10 #include <vector> |
| 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 14 #include "remoting/jingle_glue/iq_request.h" | |
| 15 #include "remoting/jingle_glue/xmpp_proxy.h" | 16 #include "remoting/jingle_glue/xmpp_proxy.h" |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 | 19 |
| 19 class XmppProxy; | 20 class XmppProxy; |
| 20 | 21 |
| 21 class JavascriptSignalStrategy : public SignalStrategy, | 22 class JavascriptSignalStrategy : public SignalStrategy, |
| 22 public XmppProxy::ResponseCallback, | 23 public XmppProxy::ResponseCallback, |
| 23 public base::NonThreadSafe { | 24 public base::NonThreadSafe { |
| 24 public: | 25 public: |
| 25 explicit JavascriptSignalStrategy(const std::string& your_jid); | 26 explicit JavascriptSignalStrategy(const std::string& your_jid); |
| 26 virtual ~JavascriptSignalStrategy(); | 27 virtual ~JavascriptSignalStrategy(); |
| 27 | 28 |
| 28 void AttachXmppProxy(scoped_refptr<XmppProxy> xmpp_proxy); | 29 void AttachXmppProxy(scoped_refptr<XmppProxy> xmpp_proxy); |
| 29 | 30 |
| 30 // SignalStrategy interface. | 31 // SignalStrategy interface. |
| 31 virtual void Init(StatusObserver* observer) OVERRIDE; | 32 virtual void Init(StatusObserver* observer) OVERRIDE; |
| 32 virtual void Close() OVERRIDE; | 33 virtual void Close() OVERRIDE; |
| 33 virtual void SetListener(Listener* listener) OVERRIDE; | 34 virtual void AddListener(Listener* listener) OVERRIDE; |
| 34 virtual void SendStanza(buzz::XmlElement* stanza) OVERRIDE; | 35 virtual void RemoveListener(Listener* listener) OVERRIDE; |
| 36 virtual bool SendStanza(buzz::XmlElement* stanza) OVERRIDE; |
| 35 virtual std::string GetNextId() OVERRIDE; | 37 virtual std::string GetNextId() OVERRIDE; |
| 36 virtual IqRequest* CreateIqRequest() OVERRIDE; | |
| 37 | 38 |
| 38 // XmppProxy::ResponseCallback interface. | 39 // XmppProxy::ResponseCallback interface. |
| 39 virtual void OnIq(const std::string& stanza); | 40 virtual void OnIq(const std::string& stanza); |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 std::string your_jid_; | 43 std::string your_jid_; |
| 43 scoped_refptr<XmppProxy> xmpp_proxy_; | 44 scoped_refptr<XmppProxy> xmpp_proxy_; |
| 44 IqRegistry iq_registry_; | |
| 45 | 45 |
| 46 Listener* listener_; | 46 std::vector<Listener*> listeners_; |
| 47 | 47 |
| 48 int last_id_; | 48 int last_id_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(JavascriptSignalStrategy); | 50 DISALLOW_COPY_AND_ASSIGN(JavascriptSignalStrategy); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace remoting | 53 } // namespace remoting |
| 54 | 54 |
| 55 #endif // REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ | 55 #endif // REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ |
| OLD | NEW |