Chromium Code Reviews| 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 return; | |
|
Wez
2012/03/30 22:20:15
nit: Consider adding the TODO(): Implement me! as
simonmorris
2012/03/30 22:36:07
Done.
| |
| 110 } | |
| 111 | |
| 107 void ChromotingClient::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 112 void ChromotingClient::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| 108 const base::Closure& done) { | 113 const base::Closure& done) { |
| 109 DCHECK(message_loop()->BelongsToCurrentThread()); | 114 DCHECK(message_loop()->BelongsToCurrentThread()); |
| 110 | 115 |
| 111 // If the video packet is empty then drop it. Empty packets are used to | 116 // If the video packet is empty then drop it. Empty packets are used to |
| 112 // maintain activity on the network. | 117 // maintain activity on the network. |
| 113 if (!packet->has_data() || packet->data().size() == 0) { | 118 if (!packet->has_data() || packet->data().size() == 0) { |
| 114 done.Run(); | 119 done.Run(); |
| 115 return; | 120 return; |
| 116 } | 121 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 thread_proxy_.PostTask(FROM_HERE, base::Bind( | 216 thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| 212 &ChromotingClient::Initialize, base::Unretained(this))); | 217 &ChromotingClient::Initialize, base::Unretained(this))); |
| 213 return; | 218 return; |
| 214 } | 219 } |
| 215 | 220 |
| 216 // Initialize the decoder. | 221 // Initialize the decoder. |
| 217 rectangle_decoder_->Initialize(connection_->config()); | 222 rectangle_decoder_->Initialize(connection_->config()); |
| 218 } | 223 } |
| 219 | 224 |
| 220 } // namespace remoting | 225 } // namespace remoting |
| OLD | NEW |