| 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 #include "remoting/jingle_glue/javascript_signal_strategy.h" | 5 #include "remoting/jingle_glue/javascript_signal_strategy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "remoting/jingle_glue/iq_request.h" | 11 #include "remoting/jingle_glue/iq_request.h" |
| 12 #include "remoting/jingle_glue/xmpp_proxy.h" | 12 #include "remoting/jingle_glue/xmpp_proxy.h" |
| 13 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 13 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 | 16 |
| 17 JavascriptSignalStrategy::JavascriptSignalStrategy(const std::string& your_jid) | 17 JavascriptSignalStrategy::JavascriptSignalStrategy(const std::string& your_jid) |
| 18 : your_jid_(your_jid), | 18 : your_jid_(your_jid), |
| 19 listener_(NULL), | 19 listener_(NULL), |
| 20 last_id_(0) { | 20 last_id_(0) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 JavascriptSignalStrategy::~JavascriptSignalStrategy() { | 23 JavascriptSignalStrategy::~JavascriptSignalStrategy() { |
| 24 DCHECK(listener_ == NULL); | 24 DCHECK(listener_ == NULL); |
| 25 Close(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 void JavascriptSignalStrategy::AttachXmppProxy( | 28 void JavascriptSignalStrategy::AttachXmppProxy( |
| 28 scoped_refptr<XmppProxy> xmpp_proxy) { | 29 scoped_refptr<XmppProxy> xmpp_proxy) { |
| 29 xmpp_proxy_ = xmpp_proxy; | 30 xmpp_proxy_ = xmpp_proxy; |
| 30 xmpp_proxy_->AttachCallback(AsWeakPtr()); | 31 xmpp_proxy_->AttachCallback(AsWeakPtr()); |
| 31 } | 32 } |
| 32 | 33 |
| 33 void JavascriptSignalStrategy::Init(StatusObserver* observer) { | 34 void JavascriptSignalStrategy::Init(StatusObserver* observer) { |
| 34 DCHECK(CalledOnValidThread()); | 35 DCHECK(CalledOnValidThread()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 LOG(WARNING) << "Malformed XMPP stanza received: " << stanza_str; | 88 LOG(WARNING) << "Malformed XMPP stanza received: " << stanza_str; |
| 88 return; | 89 return; |
| 89 } | 90 } |
| 90 | 91 |
| 91 if (listener_) | 92 if (listener_) |
| 92 listener_->OnIncomingStanza(stanza.get()); | 93 listener_->OnIncomingStanza(stanza.get()); |
| 93 iq_registry_.OnIncomingStanza(stanza.get()); | 94 iq_registry_.OnIncomingStanza(stanza.get()); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace remoting | 97 } // namespace remoting |
| OLD | NEW |