Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: remoting/client/ios/bridge/client_instance.cc

Issue 2753963002: Refactoring and rewriting the chromoting jni instance to be chromoting session. (Closed)
Patch Set: Fixed feedback. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ios/bridge/client_instance.h" 5 #include "remoting/client/ios/bridge/client_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "jingle/glue/thread_wrapper.h" 12 #include "jingle/glue/thread_wrapper.h"
13 #include "net/socket/client_socket_factory.h" 13 #include "net/socket/client_socket_factory.h"
14 #include "remoting/base/chromium_url_request.h" 14 #include "remoting/base/chromium_url_request.h"
15 #include "remoting/base/url_request_context_getter.h" 15 #include "remoting/base/url_request_context_getter.h"
16 #include "remoting/client/audio_player.h" 16 #include "remoting/client/audio_player.h"
17 #include "remoting/client/client_status_logger.h" 17 //#include "remoting/client/client_status_logger.h"
Yuwei 2017/04/03 21:40:46 Remove this include?
nicholss 2017/04/03 21:56:00 I will when I work on this next. This code does no
18 #include "remoting/client/ios/bridge/client_proxy.h" 18 #include "remoting/client/ios/bridge/client_proxy.h"
19 #include "remoting/proto/event.pb.h" 19 #include "remoting/proto/event.pb.h"
20 #include "remoting/protocol/chromium_port_allocator_factory.h" 20 #include "remoting/protocol/chromium_port_allocator_factory.h"
21 #include "remoting/protocol/client_authentication_config.h" 21 #include "remoting/protocol/client_authentication_config.h"
22 #include "remoting/protocol/host_stub.h" 22 #include "remoting/protocol/host_stub.h"
23 #include "remoting/protocol/negotiating_client_authenticator.h" 23 #include "remoting/protocol/negotiating_client_authenticator.h"
24 #include "remoting/protocol/transport_context.h" 24 #include "remoting/protocol/transport_context.h"
25 #include "remoting/signaling/delegating_signal_strategy.h" 25 #include "remoting/signaling/delegating_signal_strategy.h"
26 26
27 27
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 protocol::KeyEvent action; 184 protocol::KeyEvent action;
185 action.set_usb_keycode(key_code); 185 action.set_usb_keycode(key_code);
186 action.set_pressed(key_down); 186 action.set_pressed(key_down);
187 client_->input_stub()->InjectKeyEvent(action); 187 client_->input_stub()->InjectKeyEvent(action);
188 } 188 }
189 189
190 void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state, 190 void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state,
191 protocol::ErrorCode error) { 191 protocol::ErrorCode error) {
192 DCHECK(network_task_runner_->BelongsToCurrentThread()); 192 DCHECK(network_task_runner_->BelongsToCurrentThread());
193 193
194 client_status_logger_->LogSessionStateChange(state, error); 194 // client_status_logger_->LogSessionStateChange(state, error);
195 195
196 ui_task_runner_->PostTask( 196 ui_task_runner_->PostTask(
197 FROM_HERE, base::Bind(&ClientInstance::HandleConnectionStateOnUIThread, 197 FROM_HERE, base::Bind(&ClientInstance::HandleConnectionStateOnUIThread,
198 this, state, error)); 198 this, state, error));
199 } 199 }
200 200
201 void ClientInstance::OnConnectionReady(bool ready) { 201 void ClientInstance::OnConnectionReady(bool ready) {
202 // We ignore this message, since OnConnectionState tells us the same thing. 202 // We ignore this message, since OnConnectionState tells us the same thing.
203 } 203 }
204 204
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 client_.reset(new ChromotingClient( 281 client_.reset(new ChromotingClient(
282 client_context_.get(), this, video_renderer_.get(), 282 client_context_.get(), this, video_renderer_.get(),
283 nullptr // TODO(nicholss): GetAudioConsumer().get() 283 nullptr // TODO(nicholss): GetAudioConsumer().get()
284 )); 284 ));
285 285
286 signaling_.reset( 286 signaling_.reset(
287 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), 287 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
288 url_requester_, xmpp_config_)); 288 url_requester_, xmpp_config_));
289 289
290 client_status_logger_.reset(new ClientStatusLogger( 290 // client_status_logger_.reset(new ClientStatusLogger(
291 ServerLogEntry::ME2ME, signaling_.get(), kDirectoryBotJid)); 291 // ServerLogEntry::ME2ME, signaling_.get(), kDirectoryBotJid));
292 292
293 protocol::NetworkSettings network_settings( 293 protocol::NetworkSettings network_settings(
294 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); 294 protocol::NetworkSettings::NAT_TRAVERSAL_FULL);
295 295
296 // Use Chrome's network stack to allocate ports for peer-to-peer channels. 296 // Use Chrome's network stack to allocate ports for peer-to-peer channels.
297 297
298 scoped_refptr<protocol::TransportContext> transport_context = 298 scoped_refptr<protocol::TransportContext> transport_context =
299 new protocol::TransportContext( 299 new protocol::TransportContext(
300 signaling_.get(), 300 signaling_.get(),
301 base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()), 301 base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
(...skipping 15 matching lines...) Expand all
317 // } 317 // }
318 // 318 //
319 // return audio_player_->GetAudioConsumer(); 319 // return audio_player_->GetAudioConsumer();
320 // } 320 // }
321 321
322 void ClientInstance::DisconnectFromHostOnNetworkThread() { 322 void ClientInstance::DisconnectFromHostOnNetworkThread() {
323 DCHECK(network_task_runner_->BelongsToCurrentThread()); 323 DCHECK(network_task_runner_->BelongsToCurrentThread());
324 324
325 // |client_| must be torn down before |signaling_|. 325 // |client_| must be torn down before |signaling_|.
326 client_.reset(); 326 client_.reset();
327 client_status_logger_.reset(); 327 // client_status_logger_.reset();
328 signaling_.reset(); 328 signaling_.reset();
329 perf_tracker_.reset(); 329 perf_tracker_.reset();
330 // audio_consumer_->reset(); // TODO(nicholss): Or should this be a call to 330 // audio_consumer_->reset(); // TODO(nicholss): Or should this be a call to
331 // Stop? 331 // Stop?
332 // audio_player_->reset(); // TODO(nicholss): Or should this be a call to 332 // audio_player_->reset(); // TODO(nicholss): Or should this be a call to
333 // Stop? 333 // Stop?
334 video_renderer_.reset(); 334 video_renderer_.reset();
335 client_context_->Stop(); 335 client_context_->Stop();
336 } 336 }
337 337
(...skipping 16 matching lines...) Expand all
354 return; 354 return;
355 } 355 }
356 356
357 VLOG(1) << "Attempting to pair with host"; 357 VLOG(1) << "Attempting to pair with host";
358 protocol::PairingRequest request; 358 protocol::PairingRequest request;
359 request.set_client_name(device_id_); 359 request.set_client_name(device_id_);
360 client_->host_stub()->RequestPairing(request); 360 client_->host_stub()->RequestPairing(request);
361 } 361 }
362 362
363 } // namespace remoting 363 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698