Home | History | Annotate | Download | only in plugin
      1 // Copyright (c) 2012 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.
      4 
      5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_
      6 #define REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_
      7 
      8 #include "base/callback.h"
      9 #include "base/observer_list.h"
     10 #include "remoting/jingle_glue/signal_strategy.h"
     11 
     12 namespace base {
     13 class SingleThreadTaskRunner;
     14 }  // namespace base
     15 
     16 namespace remoting {
     17 
     18 class PepperSignalStrategy : public SignalStrategy {
     19  public:
     20   typedef base::Callback<void(const std::string&)> SendIqCallback;
     21 
     22   PepperSignalStrategy(std::string local_jid,
     23                        const SendIqCallback& send_iq_callback);
     24   virtual ~PepperSignalStrategy();
     25 
     26   void OnIncomingMessage(const std::string& message);
     27 
     28   // SignalStrategy interface.
     29   virtual void Connect() OVERRIDE;
     30   virtual void Disconnect() OVERRIDE;
     31   virtual State GetState() const OVERRIDE;
     32   virtual Error GetError() const OVERRIDE;
     33   virtual std::string GetLocalJid() const OVERRIDE;
     34   virtual void AddListener(Listener* listener) OVERRIDE;
     35   virtual void RemoveListener(Listener* listener) OVERRIDE;
     36   virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE;
     37   virtual std::string GetNextId() OVERRIDE;
     38 
     39  private:
     40   std::string local_jid_;
     41   SendIqCallback send_iq_callback_;
     42 
     43   ObserverList<Listener> listeners_;
     44 
     45   int last_id_;
     46 
     47   DISALLOW_COPY_AND_ASSIGN(PepperSignalStrategy);
     48 };
     49 
     50 }  // namespace remoting
     51 
     52 #endif  // REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_
     53