| 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/client/chromoting_view.h" | 8 #include "remoting/client/chromoting_view.h" |
| 9 #include "remoting/client/client_context.h" | 9 #include "remoting/client/client_context.h" |
| 10 #include "remoting/client/rectangle_update_decoder.h" | 10 #include "remoting/client/rectangle_update_decoder.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 authenticator.reset(new protocol::V1ClientAuthenticator( | 54 authenticator.reset(new protocol::V1ClientAuthenticator( |
| 55 config_.local_jid, config_.shared_secret)); | 55 config_.local_jid, config_.shared_secret)); |
| 56 } else { | 56 } else { |
| 57 authenticator = protocol::NegotiatingAuthenticator::CreateForClient( | 57 authenticator = protocol::NegotiatingAuthenticator::CreateForClient( |
| 58 config_.authentication_tag, | 58 config_.authentication_tag, |
| 59 config_.shared_secret, config_.authentication_methods); | 59 config_.shared_secret, config_.authentication_methods); |
| 60 } | 60 } |
| 61 | 61 |
| 62 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid, | 62 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid, |
| 63 config_.host_public_key, authenticator.Pass(), | 63 config_.host_public_key, authenticator.Pass(), |
| 64 this, this, this); | 64 this, this, this, this); |
| 65 | 65 |
| 66 if (!view_->Initialize()) { | 66 if (!view_->Initialize()) { |
| 67 ClientDone(); | 67 ClientDone(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ChromotingClient::Stop(const base::Closure& shutdown_task) { | 71 void ChromotingClient::Stop(const base::Closure& shutdown_task) { |
| 72 if (!message_loop()->BelongsToCurrentThread()) { | 72 if (!message_loop()->BelongsToCurrentThread()) { |
| 73 message_loop()->PostTask( | 73 message_loop()->PostTask( |
| 74 FROM_HERE, base::Bind(&ChromotingClient::Stop, | 74 FROM_HERE, base::Bind(&ChromotingClient::Stop, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 97 if (!client_done_.is_null()) { | 97 if (!client_done_.is_null()) { |
| 98 message_loop()->PostTask(FROM_HERE, client_done_); | 98 message_loop()->PostTask(FROM_HERE, client_done_); |
| 99 client_done_.Reset(); | 99 client_done_.Reset(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 ChromotingStats* ChromotingClient::GetStats() { | 103 ChromotingStats* ChromotingClient::GetStats() { |
| 104 return &stats_; | 104 return &stats_; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ChromotingClient::InjectClipboardEvent( |
| 108 const protocol::ClipboardEvent& event) { |
| 109 // TODO(simonmorris): Pass the clipboard event to the webapp. |
| 110 return; |
| 111 } |
| 112 |
| 107 void ChromotingClient::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 113 void ChromotingClient::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| 108 const base::Closure& done) { | 114 const base::Closure& done) { |
| 109 DCHECK(message_loop()->BelongsToCurrentThread()); | 115 DCHECK(message_loop()->BelongsToCurrentThread()); |
| 110 | 116 |
| 111 // If the video packet is empty then drop it. Empty packets are used to | 117 // If the video packet is empty then drop it. Empty packets are used to |
| 112 // maintain activity on the network. | 118 // maintain activity on the network. |
| 113 if (!packet->has_data() || packet->data().size() == 0) { | 119 if (!packet->has_data() || packet->data().size() == 0) { |
| 114 done.Run(); | 120 done.Run(); |
| 115 return; | 121 return; |
| 116 } | 122 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 thread_proxy_.PostTask(FROM_HERE, base::Bind( | 217 thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| 212 &ChromotingClient::Initialize, base::Unretained(this))); | 218 &ChromotingClient::Initialize, base::Unretained(this))); |
| 213 return; | 219 return; |
| 214 } | 220 } |
| 215 | 221 |
| 216 // Initialize the decoder. | 222 // Initialize the decoder. |
| 217 rectangle_decoder_->Initialize(connection_->config()); | 223 rectangle_decoder_->Initialize(connection_->config()); |
| 218 } | 224 } |
| 219 | 225 |
| 220 } // namespace remoting | 226 } // namespace remoting |
| OLD | NEW |