Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / remoting / client / chromoting_client.h
index 65f9910..e164d7c 100644 (file)
@@ -11,8 +11,6 @@
 
 #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"
@@ -27,6 +25,7 @@ class SingleThreadTaskRunner;
 namespace remoting {
 
 namespace protocol {
+class CandidateSessionConfig;
 class TransportFactory;
 }  // namespace protocol
 
@@ -43,19 +42,33 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
                          public protocol::ClientStub {
  public:
   // |audio_player| may be null, in which case audio will not be requested.
-  ChromotingClient(const ClientConfig& config,
-                   ClientContext* client_context,
-                   protocol::ConnectionToHost* connection,
+  ChromotingClient(ClientContext* client_context,
                    ClientUserInterface* user_interface,
                    VideoRenderer* video_renderer,
                    scoped_ptr<AudioPlayer> audio_player);
 
   virtual ~ChromotingClient();
 
+  void SetProtocolConfigForTests(
+      scoped_ptr<protocol::CandidateSessionConfig> config);
+
   // Start the client. Must be called on the main thread. |signal_strategy|
   // must outlive the client.
   void Start(SignalStrategy* signal_strategy,
-             scoped_ptr<protocol::TransportFactory> transport_factory);
+             scoped_ptr<protocol::Authenticator> authenticator,
+             scoped_ptr<protocol::TransportFactory> transport_factory,
+             const std::string& host_jid,
+             const std::string& capabilities);
+
+  protocol::ConnectionToHost::State connection_state() const {
+    return connection_.state();
+  }
+
+  protocol::ClipboardStub* clipboard_forwarder() {
+    return connection_.clipboard_forwarder();
+  }
+  protocol::HostStub* host_stub() { return connection_.host_stub(); }
+  protocol::InputStub* input_stub() { return connection_.input_stub(); }
 
   // ClientStub implementation.
   virtual void SetCapabilities(
@@ -89,16 +102,15 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
   void OnChannelsConnected();
 
   // The following are not owned by this class.
-  ClientConfig config_;
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  protocol::ConnectionToHost* connection_;
   ClientUserInterface* user_interface_;
   VideoRenderer* video_renderer_;
 
+  protocol::ConnectionToHost connection_;
+
   scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
 
-  // If non-NULL, this is called when the client is done.
-  base::Closure client_done_;
+  std::string local_capabilities_;
 
   // The set of all capabilities supported by the host.
   std::string host_capabilities_;
@@ -109,10 +121,6 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
   // Record the statistics of the connection.
   ChromotingStats stats_;
 
-  // WeakPtr used to avoid tasks accessing the client after it is deleted.
-  base::WeakPtr<ChromotingClient> weak_ptr_;
-  base::WeakPtrFactory<ChromotingClient> weak_factory_;
-
   DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
 };