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" |
11 #include "remoting/protocol/authentication_method.h" | 11 #include "remoting/protocol/authentication_method.h" |
12 #include "remoting/protocol/connection_to_host.h" | 12 #include "remoting/protocol/connection_to_host.h" |
13 #include "remoting/protocol/negotiating_authenticator.h" | 13 #include "remoting/protocol/negotiating_authenticator.h" |
14 #include "remoting/protocol/v1_authenticator.h" | 14 #include "remoting/protocol/v1_authenticator.h" |
15 #include "remoting/protocol/session_config.h" | 15 #include "remoting/protocol/session_config.h" |
| 16 #include "remoting/protocol/transport.h" |
16 | 17 |
17 namespace remoting { | 18 namespace remoting { |
18 | 19 |
19 using protocol::AuthenticationMethod; | 20 using protocol::AuthenticationMethod; |
20 | 21 |
21 ChromotingClient::QueuedVideoPacket::QueuedVideoPacket( | 22 ChromotingClient::QueuedVideoPacket::QueuedVideoPacket( |
22 scoped_ptr<VideoPacket> packet, const base::Closure& done) | 23 scoped_ptr<VideoPacket> packet, const base::Closure& done) |
23 : packet(packet.release()), done(done) { | 24 : packet(packet.release()), done(done) { |
24 } | 25 } |
25 | 26 |
(...skipping 13 matching lines...) Expand all Loading... |
39 rectangle_decoder_(rectangle_decoder), | 40 rectangle_decoder_(rectangle_decoder), |
40 client_done_(client_done), | 41 client_done_(client_done), |
41 packet_being_processed_(false), | 42 packet_being_processed_(false), |
42 last_sequence_number_(0), | 43 last_sequence_number_(0), |
43 thread_proxy_(context_->network_message_loop()) { | 44 thread_proxy_(context_->network_message_loop()) { |
44 } | 45 } |
45 | 46 |
46 ChromotingClient::~ChromotingClient() { | 47 ChromotingClient::~ChromotingClient() { |
47 } | 48 } |
48 | 49 |
49 void ChromotingClient::Start(scoped_refptr<XmppProxy> xmpp_proxy) { | 50 void ChromotingClient::Start( |
| 51 scoped_refptr<XmppProxy> xmpp_proxy, |
| 52 scoped_ptr<protocol::TransportFactory> transport_factory) { |
50 DCHECK(message_loop()->BelongsToCurrentThread()); | 53 DCHECK(message_loop()->BelongsToCurrentThread()); |
51 | 54 |
52 scoped_ptr<protocol::Authenticator> authenticator; | 55 scoped_ptr<protocol::Authenticator> authenticator; |
53 if (config_.use_v1_authenticator) { | 56 if (config_.use_v1_authenticator) { |
54 authenticator.reset(new protocol::V1ClientAuthenticator( | 57 authenticator.reset(new protocol::V1ClientAuthenticator( |
55 config_.local_jid, config_.shared_secret)); | 58 config_.local_jid, config_.shared_secret)); |
56 } else { | 59 } else { |
57 authenticator = protocol::NegotiatingAuthenticator::CreateForClient( | 60 authenticator = protocol::NegotiatingAuthenticator::CreateForClient( |
58 config_.authentication_tag, | 61 config_.authentication_tag, |
59 config_.shared_secret, config_.authentication_methods); | 62 config_.shared_secret, config_.authentication_methods); |
60 } | 63 } |
61 | 64 |
62 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid, | 65 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid, |
63 config_.host_public_key, authenticator.Pass(), | 66 config_.host_public_key, transport_factory.Pass(), |
64 this, this, this, this); | 67 authenticator.Pass(), this, this, this, this); |
65 | 68 |
66 if (!view_->Initialize()) { | 69 if (!view_->Initialize()) { |
67 ClientDone(); | 70 ClientDone(); |
68 } | 71 } |
69 } | 72 } |
70 | 73 |
71 void ChromotingClient::Stop(const base::Closure& shutdown_task) { | 74 void ChromotingClient::Stop(const base::Closure& shutdown_task) { |
72 if (!message_loop()->BelongsToCurrentThread()) { | 75 if (!message_loop()->BelongsToCurrentThread()) { |
73 message_loop()->PostTask( | 76 message_loop()->PostTask( |
74 FROM_HERE, base::Bind(&ChromotingClient::Stop, | 77 FROM_HERE, base::Bind(&ChromotingClient::Stop, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 thread_proxy_.PostTask(FROM_HERE, base::Bind( | 219 thread_proxy_.PostTask(FROM_HERE, base::Bind( |
217 &ChromotingClient::Initialize, base::Unretained(this))); | 220 &ChromotingClient::Initialize, base::Unretained(this))); |
218 return; | 221 return; |
219 } | 222 } |
220 | 223 |
221 // Initialize the decoder. | 224 // Initialize the decoder. |
222 rectangle_decoder_->Initialize(connection_->config()); | 225 rectangle_decoder_->Initialize(connection_->config()); |
223 } | 226 } |
224 | 227 |
225 } // namespace remoting | 228 } // namespace remoting |
OLD | NEW |