| 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> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" |
| 15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 16 #include "remoting/jingle_glue/xmpp_proxy.h" | 17 #include "remoting/jingle_glue/xmpp_proxy.h" |
| 17 | 18 |
| 18 namespace remoting { | 19 namespace remoting { |
| 19 | 20 |
| 20 class XmppProxy; | 21 class XmppProxy; |
| 21 | 22 |
| 22 class JavascriptSignalStrategy : public SignalStrategy, | 23 class JavascriptSignalStrategy : public SignalStrategy, |
| 23 public XmppProxy::ResponseCallback, | 24 public XmppProxy::ResponseCallback, |
| 24 public base::NonThreadSafe { | 25 public base::NonThreadSafe { |
| 25 public: | 26 public: |
| 26 explicit JavascriptSignalStrategy(const std::string& your_jid); | 27 explicit JavascriptSignalStrategy(const std::string& local_jid); |
| 27 virtual ~JavascriptSignalStrategy(); | 28 virtual ~JavascriptSignalStrategy(); |
| 28 | 29 |
| 29 void AttachXmppProxy(scoped_refptr<XmppProxy> xmpp_proxy); | 30 void AttachXmppProxy(scoped_refptr<XmppProxy> xmpp_proxy); |
| 30 | 31 |
| 31 // SignalStrategy interface. | 32 // SignalStrategy interface. |
| 32 virtual void Init(StatusObserver* observer) OVERRIDE; | 33 virtual void Connect() OVERRIDE; |
| 33 virtual void Close() OVERRIDE; | 34 virtual void Disconnect() OVERRIDE; |
| 35 virtual State GetState() const OVERRIDE; |
| 36 virtual std::string GetLocalJid() const OVERRIDE; |
| 34 virtual void AddListener(Listener* listener) OVERRIDE; | 37 virtual void AddListener(Listener* listener) OVERRIDE; |
| 35 virtual void RemoveListener(Listener* listener) OVERRIDE; | 38 virtual void RemoveListener(Listener* listener) OVERRIDE; |
| 36 virtual bool SendStanza(buzz::XmlElement* stanza) OVERRIDE; | 39 virtual bool SendStanza(buzz::XmlElement* stanza) OVERRIDE; |
| 37 virtual std::string GetNextId() OVERRIDE; | 40 virtual std::string GetNextId() OVERRIDE; |
| 38 | 41 |
| 39 // XmppProxy::ResponseCallback interface. | 42 // XmppProxy::ResponseCallback interface. |
| 40 virtual void OnIq(const std::string& stanza) OVERRIDE; | 43 virtual void OnIq(const std::string& stanza) OVERRIDE; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 std::string your_jid_; | 46 std::string local_jid_; |
| 44 scoped_refptr<XmppProxy> xmpp_proxy_; | 47 scoped_refptr<XmppProxy> xmpp_proxy_; |
| 45 | 48 |
| 46 std::vector<Listener*> listeners_; | 49 ObserverList<Listener> listeners_; |
| 47 | 50 |
| 48 int last_id_; | 51 int last_id_; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(JavascriptSignalStrategy); | 53 DISALLOW_COPY_AND_ASSIGN(JavascriptSignalStrategy); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace remoting | 56 } // namespace remoting |
| 54 | 57 |
| 55 #endif // REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ | 58 #endif // REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ |
| OLD | NEW |