OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ios/bridge/client_instance.h" | 5 #include "remoting/ios/bridge/client_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "net/socket/client_socket_factory.h" | 10 #include "net/socket/client_socket_factory.h" |
11 #include "remoting/base/url_request_context_getter.h" | 11 #include "remoting/base/url_request_context_getter.h" |
12 #include "remoting/client/audio_player.h" | 12 #include "remoting/client/audio_player.h" |
13 #include "remoting/client/plugin/delegating_signal_strategy.h" | 13 #include "remoting/client/plugin/delegating_signal_strategy.h" |
14 #include "remoting/ios/bridge/client_proxy.h" | 14 #include "remoting/ios/bridge/client_proxy.h" |
15 #include "remoting/jingle_glue/chromium_port_allocator.h" | 15 #include "remoting/jingle_glue/chromium_port_allocator.h" |
16 #include "remoting/protocol/host_stub.h" | 16 #include "remoting/protocol/host_stub.h" |
17 #include "remoting/protocol/libjingle_transport_factory.h" | 17 #include "remoting/protocol/libjingle_transport_factory.h" |
| 18 #include "remoting/protocol/negotiating_client_authenticator.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 const char* const kXmppServer = "talk.google.com"; | 21 const char* const kXmppServer = "talk.google.com"; |
21 const int kXmppPort = 5222; | 22 const int kXmppPort = 5222; |
22 const bool kXmppUseTls = true; | 23 const bool kXmppUseTls = true; |
23 | 24 |
24 void DoNothing() {} | 25 void DoNothing() {} |
25 } // namespace | 26 } // namespace |
26 | 27 |
27 namespace remoting { | 28 namespace remoting { |
28 | 29 |
29 ClientInstance::ClientInstance(const base::WeakPtr<ClientProxy>& proxy, | 30 ClientInstance::ClientInstance(const base::WeakPtr<ClientProxy>& proxy, |
30 const std::string& username, | 31 const std::string& username, |
31 const std::string& auth_token, | 32 const std::string& auth_token, |
32 const std::string& host_jid, | 33 const std::string& host_jid, |
33 const std::string& host_id, | 34 const std::string& host_id, |
34 const std::string& host_pubkey, | 35 const std::string& host_pubkey, |
35 const std::string& pairing_id, | 36 const std::string& pairing_id, |
36 const std::string& pairing_secret) | 37 const std::string& pairing_secret) |
37 : proxyToClient_(proxy), host_id_(host_id), create_pairing_(false) { | 38 : proxyToClient_(proxy), |
38 | 39 host_id_(host_id), |
| 40 host_jid_(host_jid), |
| 41 create_pairing_(false) { |
39 if (!base::MessageLoop::current()) { | 42 if (!base::MessageLoop::current()) { |
40 VLOG(1) << "Starting main message loop"; | 43 VLOG(1) << "Starting main message loop"; |
41 ui_loop_ = new base::MessageLoopForUI(); | 44 ui_loop_ = new base::MessageLoopForUI(); |
42 ui_loop_->Attach(); | 45 ui_loop_->Attach(); |
43 } else { | 46 } else { |
44 VLOG(1) << "Using existing main message loop"; | 47 VLOG(1) << "Using existing main message loop"; |
45 ui_loop_ = base::MessageLoopForUI::current(); | 48 ui_loop_ = base::MessageLoopForUI::current(); |
46 } | 49 } |
47 | 50 |
48 VLOG(1) << "Spawning additional threads"; | 51 VLOG(1) << "Spawning additional threads"; |
(...skipping 15 matching lines...) Expand all Loading... |
64 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 67 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
65 | 68 |
66 // Initialize XMPP config. | 69 // Initialize XMPP config. |
67 xmpp_config_.host = kXmppServer; | 70 xmpp_config_.host = kXmppServer; |
68 xmpp_config_.port = kXmppPort; | 71 xmpp_config_.port = kXmppPort; |
69 xmpp_config_.use_tls = kXmppUseTls; | 72 xmpp_config_.use_tls = kXmppUseTls; |
70 xmpp_config_.username = username; | 73 xmpp_config_.username = username; |
71 xmpp_config_.auth_token = auth_token; | 74 xmpp_config_.auth_token = auth_token; |
72 xmpp_config_.auth_service = "oauth2"; | 75 xmpp_config_.auth_service = "oauth2"; |
73 | 76 |
74 // Initialize ClientConfig. | 77 // Initialize |authenticator_|. |
75 client_config_.host_jid = host_jid; | 78 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> |
76 client_config_.host_public_key = host_pubkey; | 79 token_fetcher(new TokenFetcherProxy( |
77 client_config_.authentication_tag = host_id_; | 80 base::Bind(&ChromotingJniInstance::FetchThirdPartyToken, |
78 client_config_.client_pairing_id = pairing_id; | 81 weak_factory_.GetWeakPtr()), |
79 client_config_.client_paired_secret = pairing_secret; | 82 host_pubkey)); |
80 client_config_.authentication_methods.push_back( | 83 |
81 protocol::AuthenticationMethod::FromString("spake2_pair")); | 84 std::vector<protocol::AuthenticationMethod> auth_methods; |
82 client_config_.authentication_methods.push_back( | 85 auth_methods.push_back(protocol::AuthenticationMethod::Spake2Pair()); |
83 protocol::AuthenticationMethod::FromString("spake2_hmac")); | 86 auth_methods.push_back(protocol::AuthenticationMethod::Spake2( |
84 client_config_.authentication_methods.push_back( | 87 protocol::AuthenticationMethod::HMAC_SHA256)); |
85 protocol::AuthenticationMethod::FromString("spake2_plain")); | 88 auth_methods.push_back(protocol::AuthenticationMethod::Spake2( |
| 89 protocol::AuthenticationMethod::NONE)); |
| 90 |
| 91 authenticator_.reset(new protocol::NegotiatingClientAuthenticator( |
| 92 pairing_id, pairing_secret, host_id_, |
| 93 base::Bind(&ClientInstance::FetchSecret, this), |
| 94 token_fetcher.Pass(), auth_methods)); |
86 } | 95 } |
87 | 96 |
88 ClientInstance::~ClientInstance() {} | 97 ClientInstance::~ClientInstance() {} |
89 | 98 |
90 void ClientInstance::Start() { | 99 void ClientInstance::Start() { |
91 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 100 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
92 | 101 |
93 // Creates a reference to |this|, so don't want to bind during constructor | |
94 client_config_.fetch_secret_callback = | |
95 base::Bind(&ClientInstance::FetchSecret, this); | |
96 | |
97 view_.reset(new FrameConsumerBridge( | 102 view_.reset(new FrameConsumerBridge( |
98 base::Bind(&ClientProxy::RedrawCanvas, proxyToClient_))); | 103 base::Bind(&ClientProxy::RedrawCanvas, proxyToClient_))); |
99 | 104 |
100 // |consumer_proxy| must be created on the UI thread to proxy calls from the | 105 // |consumer_proxy| must be created on the UI thread to proxy calls from the |
101 // network or decode thread to the UI thread, but ownership will belong to a | 106 // network or decode thread to the UI thread, but ownership will belong to a |
102 // SoftwareVideoRenderer which runs on the network thread. | 107 // SoftwareVideoRenderer which runs on the network thread. |
103 scoped_refptr<FrameConsumerProxy> consumer_proxy = | 108 scoped_refptr<FrameConsumerProxy> consumer_proxy = |
104 new FrameConsumerProxy(ui_task_runner_, view_->AsWeakPtr()); | 109 new FrameConsumerProxy(ui_task_runner_, view_->AsWeakPtr()); |
105 | 110 |
106 // Post a task to start connection | 111 // Post a task to start connection |
107 base::WaitableEvent done_event(true, false); | 112 base::WaitableEvent done_event(true, false); |
108 network_task_runner_->PostTask( | 113 network_task_runner_->PostTask( |
109 FROM_HERE, | 114 FROM_HERE, |
110 base::Bind(&ClientInstance::ConnectToHostOnNetworkThread, | 115 base::Bind(&ClientInstance::ConnectToHostOnNetworkThread, |
111 this, | 116 this, |
112 consumer_proxy, | 117 consumer_proxy, |
113 base::Bind(&base::WaitableEvent::Signal, | 118 base::Bind(&base::WaitableEvent::Signal, |
114 base::Unretained(&done_event)))); | 119 base::Unretained(&done_event)))); |
115 // Wait until initialization completes before continuing | 120 // Wait until initialization completes before continuing |
116 done_event.Wait(); | 121 done_event.Wait(); |
117 } | 122 } |
118 | 123 |
119 void ClientInstance::Cleanup() { | 124 void ClientInstance::Cleanup() { |
120 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 125 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
121 | 126 |
122 client_config_.fetch_secret_callback.Reset(); // Release ref to this | |
123 // |view_| must be destroyed on the UI thread before the producer is gone. | 127 // |view_| must be destroyed on the UI thread before the producer is gone. |
124 view_.reset(); | 128 view_.reset(); |
125 | 129 |
126 base::WaitableEvent done_event(true, false); | 130 base::WaitableEvent done_event(true, false); |
127 network_task_runner_->PostTask( | 131 network_task_runner_->PostTask( |
128 FROM_HERE, | 132 FROM_HERE, |
129 base::Bind(&ClientInstance::DisconnectFromHostOnNetworkThread, | 133 base::Bind(&ClientInstance::DisconnectFromHostOnNetworkThread, |
130 this, | 134 this, |
131 base::Bind(&base::WaitableEvent::Signal, | 135 base::Bind(&base::WaitableEvent::Signal, |
132 base::Unretained(&done_event)))); | 136 base::Unretained(&done_event)))); |
133 // Wait until we are fully disconnected before continuing | 137 // Wait until we are fully disconnected before continuing |
134 done_event.Wait(); | 138 done_event.Wait(); |
135 } | 139 } |
136 | 140 |
137 // HOST attempts to continue automatically with previously supplied credentials, | 141 // HOST attempts to continue automatically with previously supplied credentials, |
138 // if it can't it requests the user's PIN. | 142 // if it can't it requests the user's PIN. |
139 void ClientInstance::FetchSecret( | 143 void ClientInstance::FetchSecret( |
140 bool pairable, | 144 bool pairable, |
141 const protocol::SecretFetchedCallback& callback) { | 145 const protocol::SecretFetchedCallback& callback) { |
142 if (!ui_task_runner_->BelongsToCurrentThread()) { | 146 if (!ui_task_runner_->BelongsToCurrentThread()) { |
143 ui_task_runner_->PostTask( | 147 ui_task_runner_->PostTask( |
144 FROM_HERE, | 148 FROM_HERE, |
145 base::Bind(&ClientInstance::FetchSecret, this, pairable, callback)); | 149 base::Bind(&ClientInstance::FetchSecret, this, pairable, callback)); |
146 return; | 150 return; |
147 } | 151 } |
148 | 152 |
149 pin_callback_ = callback; | 153 pin_callback_ = callback; |
150 | 154 |
151 if (proxyToClient_) { | 155 if (proxyToClient_) { |
152 if (!client_config_.client_pairing_id.empty()) { | 156 // Delete pairing credentials if they exist. |
153 // We attempted to connect using an existing pairing that was rejected. | 157 proxyToClient_->CommitPairingCredentials(host_id_, "", ""); |
154 // Unless we forget about the stale credentials, we'll continue trying | |
155 // them. | |
156 VLOG(1) << "Deleting rejected pairing credentials"; | |
157 | 158 |
158 proxyToClient_->CommitPairingCredentials(host_id_, "", ""); | |
159 } | |
160 proxyToClient_->DisplayAuthenticationPrompt(pairable); | 159 proxyToClient_->DisplayAuthenticationPrompt(pairable); |
161 } | 160 } |
162 } | 161 } |
163 | 162 |
164 void ClientInstance::ProvideSecret(const std::string& pin, | 163 void ClientInstance::ProvideSecret(const std::string& pin, |
165 bool create_pairing) { | 164 bool create_pairing) { |
166 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 165 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
167 create_pairing_ = create_pairing; | 166 create_pairing_ = create_pairing; |
168 | 167 |
169 // Before this function can complete, FetchSecret must be called | 168 // Before this function can complete, FetchSecret must be called |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 221 |
223 protocol::MouseEvent action; | 222 protocol::MouseEvent action; |
224 action.set_x(position.x()); | 223 action.set_x(position.x()); |
225 action.set_y(position.y()); | 224 action.set_y(position.y()); |
226 action.set_wheel_delta_x(wheel_delta.x()); | 225 action.set_wheel_delta_x(wheel_delta.x()); |
227 action.set_wheel_delta_y(wheel_delta.y()); | 226 action.set_wheel_delta_y(wheel_delta.y()); |
228 action.set_button(mButton); | 227 action.set_button(mButton); |
229 if (mButton != protocol::MouseEvent::BUTTON_UNDEFINED) | 228 if (mButton != protocol::MouseEvent::BUTTON_UNDEFINED) |
230 action.set_button_down(button_down); | 229 action.set_button_down(button_down); |
231 | 230 |
232 connection_->input_stub()->InjectMouseEvent(action); | 231 client_->input_stub()->InjectMouseEvent(action); |
233 } | 232 } |
234 | 233 |
235 void ClientInstance::PerformKeyboardAction(int key_code, bool key_down) { | 234 void ClientInstance::PerformKeyboardAction(int key_code, bool key_down) { |
236 if (!network_task_runner_->BelongsToCurrentThread()) { | 235 if (!network_task_runner_->BelongsToCurrentThread()) { |
237 network_task_runner_->PostTask( | 236 network_task_runner_->PostTask( |
238 FROM_HERE, | 237 FROM_HERE, |
239 base::Bind( | 238 base::Bind( |
240 &ClientInstance::PerformKeyboardAction, this, key_code, key_down)); | 239 &ClientInstance::PerformKeyboardAction, this, key_code, key_down)); |
241 return; | 240 return; |
242 } | 241 } |
243 | 242 |
244 protocol::KeyEvent action; | 243 protocol::KeyEvent action; |
245 action.set_usb_keycode(key_code); | 244 action.set_usb_keycode(key_code); |
246 action.set_pressed(key_down); | 245 action.set_pressed(key_down); |
247 connection_->input_stub()->InjectKeyEvent(action); | 246 client_->input_stub()->InjectKeyEvent(action); |
248 } | 247 } |
249 | 248 |
250 void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state, | 249 void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state, |
251 protocol::ErrorCode error) { | 250 protocol::ErrorCode error) { |
252 if (!ui_task_runner_->BelongsToCurrentThread()) { | 251 if (!ui_task_runner_->BelongsToCurrentThread()) { |
253 ui_task_runner_->PostTask( | 252 ui_task_runner_->PostTask( |
254 FROM_HERE, | 253 FROM_HERE, |
255 base::Bind(&ClientInstance::OnConnectionState, this, state, error)); | 254 base::Bind(&ClientInstance::OnConnectionState, this, state, error)); |
256 return; | 255 return; |
257 } | 256 } |
258 | 257 |
259 // TODO (aboone) This functionality is not scheduled for QA yet. | 258 // TODO (aboone) This functionality is not scheduled for QA yet. |
260 // if (create_pairing_ && state == protocol::ConnectionToHost::CONNECTED) { | 259 // if (create_pairing_ && state == protocol::ConnectionToHost::CONNECTED) { |
261 // VLOG(1) << "Attempting to pair with host"; | 260 // VLOG(1) << "Attempting to pair with host"; |
262 // protocol::PairingRequest request; | 261 // protocol::PairingRequest request; |
263 // request.set_client_name("iOS"); | 262 // request.set_client_name("iOS"); |
264 // connection_->host_stub()->RequestPairing(request); | 263 // client_->host_stub()->RequestPairing(request); |
265 // } | 264 // } |
266 | 265 |
267 if (proxyToClient_) | 266 if (proxyToClient_) |
268 proxyToClient_->ReportConnectionStatus(state, error); | 267 proxyToClient_->ReportConnectionStatus(state, error); |
269 } | 268 } |
270 | 269 |
271 void ClientInstance::OnConnectionReady(bool ready) { | 270 void ClientInstance::OnConnectionReady(bool ready) { |
272 // We ignore this message, since OnConnectionState tells us the same thing. | 271 // We ignore this message, since OnConnectionState tells us the same thing. |
273 } | 272 } |
274 | 273 |
275 void ClientInstance::OnRouteChanged(const std::string& channel_name, | 274 void ClientInstance::OnRouteChanged(const std::string& channel_name, |
276 const protocol::TransportRoute& route) { | 275 const protocol::TransportRoute& route) { |
277 VLOG(1) << "Using " << protocol::TransportRoute::GetTypeString(route.type) | 276 VLOG(1) << "Using " << protocol::TransportRoute::GetTypeString(route.type) |
278 << " connection for " << channel_name << " channel"; | 277 << " connection for " << channel_name << " channel"; |
279 } | 278 } |
280 | 279 |
281 void ClientInstance::SetCapabilities(const std::string& capabilities) { | 280 void ClientInstance::SetCapabilities(const std::string& capabilities) { |
282 DCHECK(video_renderer_); | |
283 DCHECK(connection_); | |
284 DCHECK(connection_->state() == protocol::ConnectionToHost::CONNECTED); | |
285 video_renderer_->Initialize(connection_->config()); | |
286 } | 281 } |
287 | 282 |
288 void ClientInstance::SetPairingResponse( | 283 void ClientInstance::SetPairingResponse( |
289 const protocol::PairingResponse& response) { | 284 const protocol::PairingResponse& response) { |
290 if (!ui_task_runner_->BelongsToCurrentThread()) { | 285 if (!ui_task_runner_->BelongsToCurrentThread()) { |
291 ui_task_runner_->PostTask( | 286 ui_task_runner_->PostTask( |
292 FROM_HERE, | 287 FROM_HERE, |
293 base::Bind(&ClientInstance::SetPairingResponse, this, response)); | 288 base::Bind(&ClientInstance::SetPairingResponse, this, response)); |
294 return; | 289 return; |
295 } | 290 } |
296 | 291 |
297 VLOG(1) << "Successfully established pairing with host"; | 292 VLOG(1) << "Successfully established pairing with host"; |
298 | 293 |
299 if (proxyToClient_) | 294 if (proxyToClient_) |
300 proxyToClient_->CommitPairingCredentials( | 295 proxyToClient_->CommitPairingCredentials( |
301 host_id_, response.client_id(), response.shared_secret()); | 296 host_id_, response.client_id(), response.shared_secret()); |
302 } | 297 } |
303 | 298 |
304 void ClientInstance::DeliverHostMessage( | 299 void ClientInstance::DeliverHostMessage( |
305 const protocol::ExtensionMessage& message) { | 300 const protocol::ExtensionMessage& message) { |
306 NOTIMPLEMENTED(); | 301 NOTIMPLEMENTED(); |
307 } | 302 } |
308 | 303 |
309 // Returning interface of protocol::ClipboardStub | 304 // Returning interface of protocol::ClipboardStub |
310 protocol::ClipboardStub* ClientInstance::GetClipboardStub() { return this; } | 305 protocol::ClipboardStub* ClientInstance::GetClipboardStub() { return this; } |
311 | 306 |
312 // Returning interface of protocol::CursorShapeStub | 307 // Returning interface of protocol::CursorShapeStub |
313 protocol::CursorShapeStub* ClientInstance::GetCursorShapeStub() { return this; } | 308 protocol::CursorShapeStub* ClientInstance::GetCursorShapeStub() { return this; } |
314 | 309 |
315 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> | |
316 ClientInstance::GetTokenFetcher(const std::string& host_public_key) { | |
317 // Returns null when third-party authentication is unsupported. | |
318 return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>(); | |
319 } | |
320 | |
321 void ClientInstance::InjectClipboardEvent( | 310 void ClientInstance::InjectClipboardEvent( |
322 const protocol::ClipboardEvent& event) { | 311 const protocol::ClipboardEvent& event) { |
323 NOTIMPLEMENTED(); | 312 NOTIMPLEMENTED(); |
324 } | 313 } |
325 | 314 |
326 void ClientInstance::SetCursorShape(const protocol::CursorShapeInfo& shape) { | 315 void ClientInstance::SetCursorShape(const protocol::CursorShapeInfo& shape) { |
327 if (!ui_task_runner_->BelongsToCurrentThread()) { | 316 if (!ui_task_runner_->BelongsToCurrentThread()) { |
328 ui_task_runner_->PostTask( | 317 ui_task_runner_->PostTask( |
329 FROM_HERE, base::Bind(&ClientInstance::SetCursorShape, this, shape)); | 318 FROM_HERE, base::Bind(&ClientInstance::SetCursorShape, this, shape)); |
330 return; | 319 return; |
331 } | 320 } |
332 if (proxyToClient_) | 321 if (proxyToClient_) |
333 proxyToClient_->UpdateCursorShape(shape); | 322 proxyToClient_->UpdateCursorShape(shape); |
334 } | 323 } |
335 | 324 |
336 void ClientInstance::ConnectToHostOnNetworkThread( | 325 void ClientInstance::ConnectToHostOnNetworkThread( |
337 scoped_refptr<FrameConsumerProxy> consumer_proxy, | 326 scoped_refptr<FrameConsumerProxy> consumer_proxy, |
338 const base::Closure& done) { | 327 const base::Closure& done) { |
339 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 328 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
340 | 329 |
341 client_context_->Start(); | 330 client_context_->Start(); |
342 | 331 |
343 video_renderer_.reset( | 332 video_renderer_.reset( |
344 new SoftwareVideoRenderer(client_context_->main_task_runner(), | 333 new SoftwareVideoRenderer(client_context_->main_task_runner(), |
345 client_context_->decode_task_runner(), | 334 client_context_->decode_task_runner(), |
346 consumer_proxy)); | 335 consumer_proxy)); |
347 | 336 |
348 view_->Initialize(video_renderer_.get()); | 337 view_->Initialize(video_renderer_.get()); |
349 | 338 |
350 connection_.reset(new protocol::ConnectionToHost(true)); | 339 client_.reset(new ChromotingClient(client_context_.get(), |
351 | |
352 client_.reset(new ChromotingClient(client_config_, | |
353 client_context_.get(), | |
354 connection_.get(), | |
355 this, | 340 this, |
356 video_renderer_.get(), | 341 video_renderer_.get(), |
357 scoped_ptr<AudioPlayer>())); | 342 scoped_ptr<AudioPlayer>())); |
358 | 343 |
359 signaling_.reset( | 344 signaling_.reset( |
360 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), | 345 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), |
361 url_requester_, | 346 url_requester_, |
362 xmpp_config_)); | 347 xmpp_config_)); |
363 | 348 |
364 NetworkSettings network_settings(NetworkSettings::NAT_TRAVERSAL_ENABLED); | 349 NetworkSettings network_settings(NetworkSettings::NAT_TRAVERSAL_ENABLED); |
365 | 350 |
366 scoped_ptr<ChromiumPortAllocator> port_allocator( | 351 scoped_ptr<ChromiumPortAllocator> port_allocator( |
367 ChromiumPortAllocator::Create(url_requester_, network_settings)); | 352 ChromiumPortAllocator::Create(url_requester_, network_settings)); |
368 | 353 |
369 scoped_ptr<protocol::TransportFactory> transport_factory( | 354 scoped_ptr<protocol::TransportFactory> transport_factory( |
370 new protocol::LibjingleTransportFactory( | 355 new protocol::LibjingleTransportFactory( |
371 signaling_.get(), | 356 signaling_.get(), |
372 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), | 357 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), |
373 network_settings)); | 358 network_settings)); |
374 | 359 |
375 client_->Start(signaling_.get(), transport_factory.Pass()); | 360 client_->Start(signaling_.get(), authenticator_.Pass(), |
| 361 transport_factory.Pass(), host_jid_, std::string()); |
376 | 362 |
377 if (!done.is_null()) | 363 if (!done.is_null()) |
378 done.Run(); | 364 done.Run(); |
379 } | 365 } |
380 | 366 |
381 void ClientInstance::DisconnectFromHostOnNetworkThread( | 367 void ClientInstance::DisconnectFromHostOnNetworkThread( |
382 const base::Closure& done) { | 368 const base::Closure& done) { |
383 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 369 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
384 | 370 |
385 host_id_.clear(); | 371 host_id_.clear(); |
386 | 372 |
387 // |client_| must be torn down before |signaling_|. | 373 // |client_| must be torn down before |signaling_|. |
388 connection_.reset(); | |
389 client_.reset(); | 374 client_.reset(); |
390 signaling_.reset(); | 375 signaling_.reset(); |
391 video_renderer_.reset(); | 376 video_renderer_.reset(); |
392 client_context_->Stop(); | 377 client_context_->Stop(); |
393 if (!done.is_null()) | 378 if (!done.is_null()) |
394 done.Run(); | 379 done.Run(); |
395 } | 380 } |
396 | 381 |
397 } // namespace remoting | 382 } // namespace remoting |
OLD | NEW |