#ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_
#define REMOTING_CLIENT_CHROMOTING_CLIENT_H_
#include <string>
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "remoting/client/client_config.h"
#include "remoting/client/chromoting_stats.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/video_stub.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace remoting {
namespace protocol {
class TransportFactory;
}
class AudioDecodeScheduler;
class AudioPlayer;
class ClientContext;
class ClientUserInterface;
class FrameConsumerProxy;
class FrameProducer;
class VideoRenderer;
class SignalStrategy;
class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
public protocol::ClientStub {
public:
ChromotingClient(const ClientConfig& config,
ClientContext* client_context,
protocol::ConnectionToHost* connection,
ClientUserInterface* user_interface,
VideoRenderer* video_renderer,
scoped_ptr<AudioPlayer> audio_player);
virtual ~ChromotingClient();
void Start(SignalStrategy* signal_strategy,
scoped_ptr<protocol::TransportFactory> transport_factory);
virtual void SetCapabilities(
const protocol::Capabilities& capabilities) OVERRIDE;
virtual void SetPairingResponse(
const protocol::PairingResponse& pairing_response) OVERRIDE;
virtual void DeliverHostMessage(
const protocol::ExtensionMessage& message) OVERRIDE;
virtual void InjectClipboardEvent(
const protocol::ClipboardEvent& event) OVERRIDE;
virtual void SetCursorShape(
const protocol::CursorShapeInfo& cursor_shape) OVERRIDE;
virtual void OnConnectionState(
protocol::ConnectionToHost::State state,
protocol::ErrorCode error) OVERRIDE;
virtual void OnConnectionReady(bool ready) OVERRIDE;
virtual void OnRouteChanged(const std::string& channel_name,
const protocol::TransportRoute& route) OVERRIDE;
private:
void OnAuthenticated();
void OnChannelsConnected();
ClientConfig config_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
protocol::ConnectionToHost* connection_;
ClientUserInterface* user_interface_;
VideoRenderer* video_renderer_;
scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
base::Closure client_done_;
std::string host_capabilities_;
bool host_capabilities_received_;
ChromotingStats stats_;
base::WeakPtr<ChromotingClient> weak_ptr_;
base::WeakPtrFactory<ChromotingClient> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
};
}
#endif