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

Side by Side Diff: remoting/client/jni/chromoting_jni_instance.cc

Issue 1521883006: Add TransportContext class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « remoting/client/chromoting_client.cc ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/jni/chromoting_jni_instance.h" 5 #include "remoting/client/jni/chromoting_jni_instance.h"
6 6
7 #include <android/log.h> 7 #include <android/log.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "jingle/glue/thread_wrapper.h" 11 #include "jingle/glue/thread_wrapper.h"
12 #include "net/socket/client_socket_factory.h" 12 #include "net/socket/client_socket_factory.h"
13 #include "remoting/base/service_urls.h" 13 #include "remoting/base/service_urls.h"
14 #include "remoting/client/audio_player.h" 14 #include "remoting/client/audio_player.h"
15 #include "remoting/client/client_status_logger.h" 15 #include "remoting/client/client_status_logger.h"
16 #include "remoting/client/jni/android_keymap.h" 16 #include "remoting/client/jni/android_keymap.h"
17 #include "remoting/client/jni/chromoting_jni_runtime.h" 17 #include "remoting/client/jni/chromoting_jni_runtime.h"
18 #include "remoting/client/jni/jni_frame_consumer.h" 18 #include "remoting/client/jni/jni_frame_consumer.h"
19 #include "remoting/client/software_video_renderer.h" 19 #include "remoting/client/software_video_renderer.h"
20 #include "remoting/client/token_fetcher_proxy.h" 20 #include "remoting/client/token_fetcher_proxy.h"
21 #include "remoting/protocol/chromium_port_allocator.h" 21 #include "remoting/protocol/chromium_port_allocator.h"
22 #include "remoting/protocol/chromium_socket_factory.h" 22 #include "remoting/protocol/chromium_socket_factory.h"
23 #include "remoting/protocol/host_stub.h" 23 #include "remoting/protocol/host_stub.h"
24 #include "remoting/protocol/ice_transport_factory.h"
25 #include "remoting/protocol/negotiating_client_authenticator.h" 24 #include "remoting/protocol/negotiating_client_authenticator.h"
26 #include "remoting/protocol/network_settings.h" 25 #include "remoting/protocol/network_settings.h"
27 #include "remoting/protocol/performance_tracker.h" 26 #include "remoting/protocol/performance_tracker.h"
27 #include "remoting/protocol/transport_context.h"
28 #include "remoting/signaling/server_log_entry.h" 28 #include "remoting/signaling/server_log_entry.h"
29 #include "ui/events/keycodes/dom/keycode_converter.h" 29 #include "ui/events/keycodes/dom/keycode_converter.h"
30 30
31 namespace remoting { 31 namespace remoting {
32 32
33 namespace { 33 namespace {
34 34
35 // TODO(solb) Move into location shared with client plugin. 35 // TODO(solb) Move into location shared with client plugin.
36 const char* const kXmppServer = "talk.google.com"; 36 const char* const kXmppServer = "talk.google.com";
37 const int kXmppPort = 5222; 37 const int kXmppPort = 5222;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 client_status_logger_.reset( 417 client_status_logger_.reset(
418 new ClientStatusLogger(ServerLogEntry::ME2ME, 418 new ClientStatusLogger(ServerLogEntry::ME2ME,
419 signaling_.get(), 419 signaling_.get(),
420 ServiceUrls::GetInstance()->directory_bot_jid())); 420 ServiceUrls::GetInstance()->directory_bot_jid()));
421 421
422 protocol::NetworkSettings network_settings( 422 protocol::NetworkSettings network_settings(
423 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); 423 protocol::NetworkSettings::NAT_TRAVERSAL_FULL);
424 424
425 // Use Chrome's network stack to allocate ports for peer-to-peer channels. 425 // Use Chrome's network stack to allocate ports for peer-to-peer channels.
426 scoped_ptr<protocol::ChromiumPortAllocator> port_allocator( 426 scoped_ptr<protocol::ChromiumPortAllocatorFactory> port_allocator_factory(
427 protocol::ChromiumPortAllocator::Create(jni_runtime_->url_requester(), 427 new protocol::ChromiumPortAllocatorFactory(
428 network_settings)); 428 jni_runtime_->url_requester()));
429 429
430 scoped_ptr<protocol::TransportFactory> transport_factory( 430 scoped_refptr<protocol::TransportContext> transport_context =
431 new protocol::IceTransportFactory( 431 new protocol::TransportContext(
432 signaling_.get(), port_allocator.Pass(), network_settings, 432 signaling_.get(), port_allocator_factory.Pass(), network_settings,
433 protocol::TransportRole::CLIENT)); 433 protocol::TransportRole::CLIENT);
434 434
435 client_->Start(signaling_.get(), authenticator_.Pass(), 435 client_->Start(signaling_.get(), authenticator_.Pass(), transport_context,
436 transport_factory.Pass(), host_jid_, capabilities_); 436 host_jid_, capabilities_);
437 } 437 }
438 438
439 void ChromotingJniInstance::FetchSecret( 439 void ChromotingJniInstance::FetchSecret(
440 bool pairable, 440 bool pairable,
441 const protocol::SecretFetchedCallback& callback) { 441 const protocol::SecretFetchedCallback& callback) {
442 if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) { 442 if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) {
443 jni_runtime_->ui_task_runner()->PostTask( 443 jni_runtime_->ui_task_runner()->PostTask(
444 FROM_HERE, base::Bind(&ChromotingJniInstance::FetchSecret, 444 FROM_HERE, base::Bind(&ChromotingJniInstance::FetchSecret,
445 this, pairable, callback)); 445 this, pairable, callback));
446 return; 446 return;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 perf_tracker_->round_trip_ms()); 506 perf_tracker_->round_trip_ms());
507 507
508 client_status_logger_->LogStatistics(perf_tracker_.get()); 508 client_status_logger_->LogStatistics(perf_tracker_.get());
509 509
510 jni_runtime_->network_task_runner()->PostDelayedTask( 510 jni_runtime_->network_task_runner()->PostDelayedTask(
511 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), 511 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this),
512 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); 512 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs));
513 } 513 }
514 514
515 } // namespace remoting 515 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.cc ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698