diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 23:42:18 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 23:42:18 +0000 |
commit | 04a97ada0f1f07675bad41f641c675e558e3a4a2 (patch) | |
tree | 010bb2f372ff7100712a45a2803c4049e37aaa47 /remoting/jingle_glue | |
parent | f26c5562d76ec0a10c6906d595ab32d42deec410 (diff) | |
download | chromium_src-04a97ada0f1f07675bad41f641c675e558e3a4a2.zip chromium_src-04a97ada0f1f07675bad41f641c675e558e3a4a2.tar.gz chromium_src-04a97ada0f1f07675bad41f641c675e558e3a4a2.tar.bz2 |
Remove XmppProxy and JavascriptSignalStrategy.
Instead of using XmppProxy and JavascriptSignalStrategy to provide
signaling for the client the client plugin now uses the new
PepperSignalStrategy class which implements SignalStrategy
interface directly.
R=garykac@chromium.org
Review URL: https://codereview.chromium.org/16168008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue')
-rw-r--r-- | remoting/jingle_glue/javascript_signal_strategy.cc | 106 | ||||
-rw-r--r-- | remoting/jingle_glue/javascript_signal_strategy.h | 59 | ||||
-rw-r--r-- | remoting/jingle_glue/xmpp_proxy.h | 55 |
3 files changed, 0 insertions, 220 deletions
diff --git a/remoting/jingle_glue/javascript_signal_strategy.cc b/remoting/jingle_glue/javascript_signal_strategy.cc deleted file mode 100644 index 7b45eba..0000000 --- a/remoting/jingle_glue/javascript_signal_strategy.cc +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/jingle_glue/javascript_signal_strategy.h" - -#include <algorithm> - -#include "base/logging.h" -#include "base/strings/string_number_conversions.h" -#include "remoting/jingle_glue/xmpp_proxy.h" -#include "third_party/libjingle/source/talk/xmllite/xmlelement.h" - -namespace remoting { - -JavascriptSignalStrategy::JavascriptSignalStrategy(const std::string& local_jid) - : local_jid_(local_jid), - last_id_(0) { -} - -JavascriptSignalStrategy::~JavascriptSignalStrategy() { - DCHECK_EQ(listeners_.size(), 0U); - Disconnect(); -} - -void JavascriptSignalStrategy::AttachXmppProxy( - scoped_refptr<XmppProxy> xmpp_proxy) { - DCHECK(CalledOnValidThread()); - xmpp_proxy_ = xmpp_proxy; -} - -void JavascriptSignalStrategy::Connect() { - DCHECK(CalledOnValidThread()); - - xmpp_proxy_->AttachCallback(AsWeakPtr()); - FOR_EACH_OBSERVER(Listener, listeners_, - OnSignalStrategyStateChange(CONNECTED)); -} - -void JavascriptSignalStrategy::Disconnect() { - DCHECK(CalledOnValidThread()); - - if (xmpp_proxy_.get()) - xmpp_proxy_->DetachCallback(); - FOR_EACH_OBSERVER(Listener, listeners_, - OnSignalStrategyStateChange(DISCONNECTED)); -} - -SignalStrategy::State JavascriptSignalStrategy::GetState() const { - DCHECK(CalledOnValidThread()); - // TODO(sergeyu): Extend XmppProxy to provide status of the - // connection. - return CONNECTED; -} - -SignalStrategy::Error JavascriptSignalStrategy::GetError() const { - DCHECK(CalledOnValidThread()); - // TODO(sergeyu): Extend XmppProxy to provide status of the - // connection. - return OK; -} - -std::string JavascriptSignalStrategy::GetLocalJid() const { - DCHECK(CalledOnValidThread()); - return local_jid_; -} - -void JavascriptSignalStrategy::AddListener(Listener* listener) { - DCHECK(CalledOnValidThread()); - listeners_.AddObserver(listener); -} - -void JavascriptSignalStrategy::RemoveListener(Listener* listener) { - DCHECK(CalledOnValidThread()); - listeners_.RemoveObserver(listener); -} - -bool JavascriptSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) { - DCHECK(CalledOnValidThread()); - xmpp_proxy_->SendIq(stanza->Str()); - return true; -} - -std::string JavascriptSignalStrategy::GetNextId() { - DCHECK(CalledOnValidThread()); - ++last_id_; - return base::IntToString(last_id_); -} - -void JavascriptSignalStrategy::OnIq(const std::string& stanza_str) { - DCHECK(CalledOnValidThread()); - scoped_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(stanza_str)); - if (!stanza.get()) { - LOG(WARNING) << "Malformed XMPP stanza received: " << stanza_str; - return; - } - - ObserverListBase<Listener>::Iterator it(listeners_); - Listener* listener; - while ((listener = it.GetNext()) != NULL) { - if (listener->OnSignalStrategyIncomingStanza(stanza.get())) - break; - } -} - -} // namespace remoting diff --git a/remoting/jingle_glue/javascript_signal_strategy.h b/remoting/jingle_glue/javascript_signal_strategy.h deleted file mode 100644 index eaab7a2..0000000 --- a/remoting/jingle_glue/javascript_signal_strategy.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ -#define REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ - -#include "remoting/jingle_glue/signal_strategy.h" - -#include <vector> - -#include "base/compiler_specific.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/observer_list.h" -#include "base/threading/non_thread_safe.h" -#include "remoting/jingle_glue/xmpp_proxy.h" - -namespace remoting { - -class XmppProxy; - -class JavascriptSignalStrategy : public SignalStrategy, - public XmppProxy::ResponseCallback, - public base::NonThreadSafe { - public: - explicit JavascriptSignalStrategy(const std::string& local_jid); - virtual ~JavascriptSignalStrategy(); - - void AttachXmppProxy(scoped_refptr<XmppProxy> xmpp_proxy); - - // SignalStrategy interface. - virtual void Connect() OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual Error GetError() const OVERRIDE; - virtual std::string GetLocalJid() const OVERRIDE; - virtual void AddListener(Listener* listener) OVERRIDE; - virtual void RemoveListener(Listener* listener) OVERRIDE; - virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE; - virtual std::string GetNextId() OVERRIDE; - - // XmppProxy::ResponseCallback interface. - virtual void OnIq(const std::string& stanza) OVERRIDE; - - private: - std::string local_jid_; - scoped_refptr<XmppProxy> xmpp_proxy_; - - ObserverList<Listener> listeners_; - - int last_id_; - - DISALLOW_COPY_AND_ASSIGN(JavascriptSignalStrategy); -}; - -} // namespace remoting - -#endif // REMOTING_JINGLE_GLUE_JAVASCRIPT_SIGNAL_STRATEGY_H_ diff --git a/remoting/jingle_glue/xmpp_proxy.h b/remoting/jingle_glue/xmpp_proxy.h deleted file mode 100644 index 34bb974..0000000 --- a/remoting/jingle_glue/xmpp_proxy.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// The XmppProxy is a shim interface that allows a class from layers above -// the protocol to insert custom logic for dispatching the XMPP requests -// necessary for creating a jingle connection. -// -// The primary motivator for this is to allow libjingle to be sandboxed in the -// client by proxying the XMPP requests up through javascript into a -// javascript-based XMPP connection back into the GoogleTalk network. It's -// essentially a clean hack. - -#ifndef REMOTING_JINGLE_GLUE_XMPP_PROXY_H_ -#define REMOTING_JINGLE_GLUE_XMPP_PROXY_H_ - -#include <string> - -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" - -namespace remoting { - -class XmppProxy : public base::RefCountedThreadSafe<XmppProxy> { - public: - XmppProxy() {} - - class ResponseCallback : public base::SupportsWeakPtr<ResponseCallback> { - public: - ResponseCallback() {} - virtual ~ResponseCallback() {} - virtual void OnIq(const std::string& response_xml) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(ResponseCallback); - }; - - // These two must be called on the callback's message_loop. Callback will - // always been run on the callback_loop. - virtual void AttachCallback(base::WeakPtr<ResponseCallback> callback) = 0; - virtual void DetachCallback() = 0; - - virtual void SendIq(const std::string& iq_request_xml) = 0; - - protected: - friend class base::RefCountedThreadSafe<XmppProxy>; - virtual ~XmppProxy() {} - - private: - DISALLOW_COPY_AND_ASSIGN(XmppProxy); -}; - -} // namespace remoting - -#endif // REMOTING_JINGLE_GLUE_XMPP_PROXY_H_ |