OLD | NEW |
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/software_video_renderer.h" | 18 #include "remoting/client/software_video_renderer.h" |
19 #include "remoting/client/token_fetcher_proxy.h" | 19 #include "remoting/client/token_fetcher_proxy.h" |
20 #include "remoting/jingle_glue/chromium_port_allocator.h" | 20 #include "remoting/protocol/chromium_port_allocator.h" |
21 #include "remoting/jingle_glue/chromium_socket_factory.h" | 21 #include "remoting/protocol/chromium_socket_factory.h" |
22 #include "remoting/jingle_glue/network_settings.h" | |
23 #include "remoting/jingle_glue/server_log_entry.h" | |
24 #include "remoting/protocol/host_stub.h" | 22 #include "remoting/protocol/host_stub.h" |
25 #include "remoting/protocol/libjingle_transport_factory.h" | 23 #include "remoting/protocol/libjingle_transport_factory.h" |
26 #include "remoting/protocol/negotiating_client_authenticator.h" | 24 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 25 #include "remoting/protocol/network_settings.h" |
| 26 #include "remoting/signaling/server_log_entry.h" |
27 | 27 |
28 namespace remoting { | 28 namespace remoting { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // TODO(solb) Move into location shared with client plugin. | 32 // TODO(solb) Move into location shared with client plugin. |
33 const char* const kXmppServer = "talk.google.com"; | 33 const char* const kXmppServer = "talk.google.com"; |
34 const int kXmppPort = 5222; | 34 const int kXmppPort = 5222; |
35 const bool kXmppUseTls = true; | 35 const bool kXmppUseTls = true; |
36 | 36 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 signaling_.reset(new XmppSignalStrategy( | 370 signaling_.reset(new XmppSignalStrategy( |
371 net::ClientSocketFactory::GetDefaultFactory(), | 371 net::ClientSocketFactory::GetDefaultFactory(), |
372 jni_runtime_->url_requester(), xmpp_config_)); | 372 jni_runtime_->url_requester(), xmpp_config_)); |
373 | 373 |
374 client_status_logger_.reset( | 374 client_status_logger_.reset( |
375 new ClientStatusLogger(ServerLogEntry::ME2ME, | 375 new ClientStatusLogger(ServerLogEntry::ME2ME, |
376 signaling_.get(), | 376 signaling_.get(), |
377 ServiceUrls::GetInstance()->directory_bot_jid())); | 377 ServiceUrls::GetInstance()->directory_bot_jid())); |
378 | 378 |
379 NetworkSettings network_settings(NetworkSettings::NAT_TRAVERSAL_FULL); | 379 protocol::NetworkSettings network_settings( |
| 380 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); |
380 | 381 |
381 // Use Chrome's network stack to allocate ports for peer-to-peer channels. | 382 // Use Chrome's network stack to allocate ports for peer-to-peer channels. |
382 scoped_ptr<ChromiumPortAllocator> port_allocator( | 383 scoped_ptr<protocol::ChromiumPortAllocator> port_allocator( |
383 ChromiumPortAllocator::Create(jni_runtime_->url_requester(), | 384 protocol::ChromiumPortAllocator::Create(jni_runtime_->url_requester(), |
384 network_settings)); | 385 network_settings)); |
385 | 386 |
386 scoped_ptr<protocol::TransportFactory> transport_factory( | 387 scoped_ptr<protocol::TransportFactory> transport_factory( |
387 new protocol::LibjingleTransportFactory( | 388 new protocol::LibjingleTransportFactory( |
388 signaling_.get(), | 389 signaling_.get(), |
389 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), | 390 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), |
390 network_settings)); | 391 network_settings)); |
391 | 392 |
392 client_->Start(signaling_.get(), authenticator_.Pass(), | 393 client_->Start(signaling_.get(), authenticator_.Pass(), |
393 transport_factory.Pass(), host_jid_, std::string()); | 394 transport_factory.Pass(), host_jid_, std::string()); |
394 } | 395 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 stats->round_trip_ms()->Average()); | 481 stats->round_trip_ms()->Average()); |
481 | 482 |
482 client_status_logger_->LogStatistics(stats); | 483 client_status_logger_->LogStatistics(stats); |
483 | 484 |
484 jni_runtime_->network_task_runner()->PostDelayedTask( | 485 jni_runtime_->network_task_runner()->PostDelayedTask( |
485 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), | 486 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), |
486 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); | 487 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
487 } | 488 } |
488 | 489 |
489 } // namespace remoting | 490 } // namespace remoting |
OLD | NEW |