| 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 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "jingle/glue/thread_wrapper.h" | 15 #include "jingle/glue/thread_wrapper.h" |
| 16 #include "net/socket/client_socket_factory.h" | 16 #include "net/socket/client_socket_factory.h" |
| 17 #include "remoting/base/chromium_url_request.h" | 17 #include "remoting/base/chromium_url_request.h" |
| 18 #include "remoting/base/chromoting_event.h" |
| 18 #include "remoting/client/audio_player_android.h" | 19 #include "remoting/client/audio_player_android.h" |
| 19 #include "remoting/client/client_telemetry_logger.h" | 20 #include "remoting/client/client_telemetry_logger.h" |
| 20 #include "remoting/client/jni/android_keymap.h" | 21 #include "remoting/client/jni/android_keymap.h" |
| 21 #include "remoting/client/jni/chromoting_jni_runtime.h" | 22 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 22 #include "remoting/client/jni/jni_client.h" | 23 #include "remoting/client/jni/jni_client.h" |
| 23 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" | 24 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" |
| 24 #include "remoting/protocol/chromium_port_allocator_factory.h" | 25 #include "remoting/protocol/chromium_port_allocator_factory.h" |
| 25 #include "remoting/protocol/chromium_socket_factory.h" | 26 #include "remoting/protocol/chromium_socket_factory.h" |
| 26 #include "remoting/protocol/client_authentication_config.h" | 27 #include "remoting/protocol/client_authentication_config.h" |
| 27 #include "remoting/protocol/frame_consumer.h" | 28 #include "remoting/protocol/frame_consumer.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 54 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub, | 55 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub, |
| 55 std::unique_ptr<protocol::VideoRenderer> video_renderer, | 56 std::unique_ptr<protocol::VideoRenderer> video_renderer, |
| 56 const std::string& username, | 57 const std::string& username, |
| 57 const std::string& auth_token, | 58 const std::string& auth_token, |
| 58 const std::string& host_jid, | 59 const std::string& host_jid, |
| 59 const std::string& host_id, | 60 const std::string& host_id, |
| 60 const std::string& host_pubkey, | 61 const std::string& host_pubkey, |
| 61 const std::string& pairing_id, | 62 const std::string& pairing_id, |
| 62 const std::string& pairing_secret, | 63 const std::string& pairing_secret, |
| 63 const std::string& capabilities, | 64 const std::string& capabilities, |
| 64 const std::string& flags) | 65 const std::string& flags, |
| 66 const std::string& host_version, |
| 67 const std::string& host_os, |
| 68 const std::string& host_os_version) |
| 65 : jni_runtime_(jni_runtime), | 69 : jni_runtime_(jni_runtime), |
| 66 jni_client_(jni_client), | 70 jni_client_(jni_client), |
| 67 secret_fetcher_(secret_fetcher), | 71 secret_fetcher_(secret_fetcher), |
| 68 host_jid_(host_jid), | 72 host_jid_(host_jid), |
| 69 flags_(flags), | 73 flags_(flags), |
| 70 cursor_shape_stub_(std::move(cursor_shape_stub)), | 74 cursor_shape_stub_(std::move(cursor_shape_stub)), |
| 71 video_renderer_(std::move(video_renderer)), | 75 video_renderer_(std::move(video_renderer)), |
| 72 capabilities_(capabilities), | 76 capabilities_(capabilities), |
| 77 host_version_(host_version), |
| 78 host_os_(host_os), |
| 79 host_os_version_(host_os_version), |
| 73 weak_factory_(this) { | 80 weak_factory_(this) { |
| 74 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread()); | 81 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread()); |
| 75 weak_ptr_ = weak_factory_.GetWeakPtr(); | 82 weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 76 | 83 |
| 77 // Initialize XMPP config. | 84 // Initialize XMPP config. |
| 78 xmpp_config_.host = kXmppServer; | 85 xmpp_config_.host = kXmppServer; |
| 79 xmpp_config_.port = kXmppPort; | 86 xmpp_config_.port = kXmppPort; |
| 80 xmpp_config_.use_tls = kXmppUseTls; | 87 xmpp_config_.use_tls = kXmppUseTls; |
| 81 xmpp_config_.username = username; | 88 xmpp_config_.username = username; |
| 82 xmpp_config_.auth_token = auth_token; | 89 xmpp_config_.auth_token = auth_token; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 NOTIMPLEMENTED(); | 374 NOTIMPLEMENTED(); |
| 368 } | 375 } |
| 369 | 376 |
| 370 base::WeakPtr<ChromotingJniInstance> ChromotingJniInstance::GetWeakPtr() { | 377 base::WeakPtr<ChromotingJniInstance> ChromotingJniInstance::GetWeakPtr() { |
| 371 return weak_ptr_; | 378 return weak_ptr_; |
| 372 } | 379 } |
| 373 | 380 |
| 374 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { | 381 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { |
| 375 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); | 382 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); |
| 376 | 383 |
| 384 jni_runtime_->logger()->SetHostInfo( |
| 385 host_version_, ChromotingEvent::ParseOsFromString(host_os_), |
| 386 host_os_version_); |
| 387 |
| 377 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 388 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| 378 | 389 |
| 379 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); | 390 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); |
| 380 client_context_->Start(); | 391 client_context_->Start(); |
| 381 | 392 |
| 382 perf_tracker_.reset(new protocol::PerformanceTracker()); | 393 perf_tracker_.reset(new protocol::PerformanceTracker()); |
| 383 | 394 |
| 384 video_renderer_->Initialize(*client_context_, | 395 video_renderer_->Initialize(*client_context_, |
| 385 perf_tracker_.get()); | 396 perf_tracker_.get()); |
| 386 | 397 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 video_renderer_.reset(); | 506 video_renderer_.reset(); |
| 496 signaling_.reset(); | 507 signaling_.reset(); |
| 497 perf_tracker_.reset(); | 508 perf_tracker_.reset(); |
| 498 client_context_.reset(); | 509 client_context_.reset(); |
| 499 cursor_shape_stub_.reset(); | 510 cursor_shape_stub_.reset(); |
| 500 | 511 |
| 501 weak_factory_.InvalidateWeakPtrs(); | 512 weak_factory_.InvalidateWeakPtrs(); |
| 502 } | 513 } |
| 503 | 514 |
| 504 } // namespace remoting | 515 } // namespace remoting |
| OLD | NEW |