| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "remoting/base/capabilities.h" | 8 #include "remoting/base/capabilities.h" |
| 9 #include "remoting/client/audio_decode_scheduler.h" | 9 #include "remoting/client/audio_decode_scheduler.h" |
| 10 #include "remoting/client/audio_player.h" | 10 #include "remoting/client/audio_player.h" |
| 11 #include "remoting/client/client_context.h" | 11 #include "remoting/client/client_context.h" |
| 12 #include "remoting/client/client_user_interface.h" | 12 #include "remoting/client/client_user_interface.h" |
| 13 #include "remoting/client/video_renderer.h" | 13 #include "remoting/client/video_renderer.h" |
| 14 #include "remoting/proto/audio.pb.h" | 14 #include "remoting/proto/audio.pb.h" |
| 15 #include "remoting/proto/video.pb.h" | 15 #include "remoting/proto/video.pb.h" |
| 16 #include "remoting/protocol/authentication_method.h" | 16 #include "remoting/protocol/authentication_method.h" |
| 17 #include "remoting/protocol/connection_to_host.h" | 17 #include "remoting/protocol/connection_to_host.h" |
| 18 #include "remoting/protocol/host_stub.h" | 18 #include "remoting/protocol/host_stub.h" |
| 19 #include "remoting/protocol/negotiating_client_authenticator.h" | 19 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 20 #include "remoting/protocol/session_config.h" | 20 #include "remoting/protocol/session_config.h" |
| 21 #include "remoting/protocol/transport.h" | 21 #include "remoting/protocol/transport_context.h" |
| 22 | 22 |
| 23 namespace remoting { | 23 namespace remoting { |
| 24 | 24 |
| 25 using protocol::AuthenticationMethod; | 25 using protocol::AuthenticationMethod; |
| 26 | 26 |
| 27 ChromotingClient::ChromotingClient(ClientContext* client_context, | 27 ChromotingClient::ChromotingClient(ClientContext* client_context, |
| 28 ClientUserInterface* user_interface, | 28 ClientUserInterface* user_interface, |
| 29 VideoRenderer* video_renderer, | 29 VideoRenderer* video_renderer, |
| 30 scoped_ptr<AudioPlayer> audio_player) | 30 scoped_ptr<AudioPlayer> audio_player) |
| 31 : task_runner_(client_context->main_task_runner()), | 31 : task_runner_(client_context->main_task_runner()), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ChromotingClient::SetConnectionToHostForTests( | 51 void ChromotingClient::SetConnectionToHostForTests( |
| 52 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { | 52 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { |
| 53 connection_ = connection_to_host.Pass(); | 53 connection_ = connection_to_host.Pass(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ChromotingClient::Start( | 56 void ChromotingClient::Start( |
| 57 SignalStrategy* signal_strategy, | 57 SignalStrategy* signal_strategy, |
| 58 scoped_ptr<protocol::Authenticator> authenticator, | 58 scoped_ptr<protocol::Authenticator> authenticator, |
| 59 scoped_ptr<protocol::TransportFactory> transport_factory, | 59 scoped_refptr<protocol::TransportContext> transport_context, |
| 60 const std::string& host_jid, | 60 const std::string& host_jid, |
| 61 const std::string& capabilities) { | 61 const std::string& capabilities) { |
| 62 DCHECK(task_runner_->BelongsToCurrentThread()); | 62 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 63 | 63 |
| 64 local_capabilities_ = capabilities; | 64 local_capabilities_ = capabilities; |
| 65 | 65 |
| 66 connection_->set_client_stub(this); | 66 connection_->set_client_stub(this); |
| 67 connection_->set_clipboard_stub(this); | 67 connection_->set_clipboard_stub(this); |
| 68 connection_->set_video_stub(video_renderer_->GetVideoStub()); | 68 connection_->set_video_stub(video_renderer_->GetVideoStub()); |
| 69 connection_->set_audio_stub(audio_decode_scheduler_.get()); | 69 connection_->set_audio_stub(audio_decode_scheduler_.get()); |
| 70 | 70 |
| 71 connection_->Connect(signal_strategy, transport_factory.Pass(), | 71 connection_->Connect(signal_strategy, transport_context, authenticator.Pass(), |
| 72 authenticator.Pass(), host_jid, this); | 72 host_jid, this); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ChromotingClient::SetCapabilities( | 75 void ChromotingClient::SetCapabilities( |
| 76 const protocol::Capabilities& capabilities) { | 76 const protocol::Capabilities& capabilities) { |
| 77 DCHECK(task_runner_->BelongsToCurrentThread()); | 77 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 78 | 78 |
| 79 // Only accept the first |protocol::Capabilities| message. | 79 // Only accept the first |protocol::Capabilities| message. |
| 80 if (host_capabilities_received_) { | 80 if (host_capabilities_received_) { |
| 81 LOG(WARNING) << "protocol::Capabilities has been received already."; | 81 LOG(WARNING) << "protocol::Capabilities has been received already."; |
| 82 return; | 82 return; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Negotiate capabilities with the host. | 163 // Negotiate capabilities with the host. |
| 164 VLOG(1) << "Client capabilities: " << local_capabilities_; | 164 VLOG(1) << "Client capabilities: " << local_capabilities_; |
| 165 | 165 |
| 166 protocol::Capabilities capabilities; | 166 protocol::Capabilities capabilities; |
| 167 capabilities.set_capabilities(local_capabilities_); | 167 capabilities.set_capabilities(local_capabilities_); |
| 168 connection_->host_stub()->SetCapabilities(capabilities); | 168 connection_->host_stub()->SetCapabilities(capabilities); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace remoting | 171 } // namespace remoting |
| OLD | NEW |