| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "jingle/glue/thread_wrapper.h" | 22 #include "jingle/glue/thread_wrapper.h" |
| 23 #include "media/base/media.h" | 23 #include "media/base/media.h" |
| 24 #include "net/socket/ssl_server_socket.h" | 24 #include "net/socket/ssl_server_socket.h" |
| 25 #include "ppapi/cpp/completion_callback.h" | 25 #include "ppapi/cpp/completion_callback.h" |
| 26 #include "ppapi/cpp/input_event.h" | 26 #include "ppapi/cpp/input_event.h" |
| 27 #include "ppapi/cpp/mouse_cursor.h" | 27 #include "ppapi/cpp/mouse_cursor.h" |
| 28 #include "ppapi/cpp/rect.h" | 28 #include "ppapi/cpp/rect.h" |
| 29 #include "remoting/base/constants.h" | 29 #include "remoting/base/constants.h" |
| 30 #include "remoting/base/util.h" | 30 #include "remoting/base/util.h" |
| 31 #include "remoting/client/audio_decode_scheduler.h" |
| 31 #include "remoting/client/client_config.h" | 32 #include "remoting/client/client_config.h" |
| 32 #include "remoting/client/chromoting_client.h" | 33 #include "remoting/client/chromoting_client.h" |
| 33 #include "remoting/client/frame_consumer_proxy.h" | 34 #include "remoting/client/frame_consumer_proxy.h" |
| 34 #include "remoting/client/plugin/pepper_audio_player.h" | 35 #include "remoting/client/plugin/pepper_audio_player.h" |
| 35 #include "remoting/client/plugin/pepper_input_handler.h" | 36 #include "remoting/client/plugin/pepper_input_handler.h" |
| 36 #include "remoting/client/plugin/pepper_port_allocator.h" | 37 #include "remoting/client/plugin/pepper_port_allocator.h" |
| 37 #include "remoting/client/plugin/pepper_view.h" | 38 #include "remoting/client/plugin/pepper_view.h" |
| 38 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 39 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
| 39 #include "remoting/client/rectangle_update_decoder.h" | 40 #include "remoting/client/rectangle_update_decoder.h" |
| 40 #include "remoting/protocol/connection_to_host.h" | 41 #include "remoting/protocol/connection_to_host.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 464 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 464 PostChromotingMessage("onFirstFrameReceived", data.Pass()); | 465 PostChromotingMessage("onFirstFrameReceived", data.Pass()); |
| 465 } | 466 } |
| 466 | 467 |
| 467 void ChromotingInstance::Connect(const ClientConfig& config) { | 468 void ChromotingInstance::Connect(const ClientConfig& config) { |
| 468 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 469 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 469 | 470 |
| 470 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); | 471 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); |
| 471 | 472 |
| 472 host_connection_.reset(new protocol::ConnectionToHost(true)); | 473 host_connection_.reset(new protocol::ConnectionToHost(true)); |
| 473 audio_player_.reset(new PepperAudioPlayer(this)); | 474 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); |
| 474 client_.reset(new ChromotingClient(config, context_.main_task_runner(), | 475 client_.reset(new ChromotingClient(config, context_, |
| 475 host_connection_.get(), this, | 476 host_connection_.get(), this, |
| 476 rectangle_decoder_.get(), | 477 rectangle_decoder_.get(), |
| 477 audio_player_.get())); | 478 audio_player.Pass())); |
| 478 | 479 |
| 479 // Construct the input pipeline | 480 // Construct the input pipeline |
| 480 mouse_input_filter_.reset( | 481 mouse_input_filter_.reset( |
| 481 new protocol::MouseInputFilter(host_connection_->input_stub())); | 482 new protocol::MouseInputFilter(host_connection_->input_stub())); |
| 482 mouse_input_filter_->set_input_size(view_->get_view_size_dips()); | 483 mouse_input_filter_->set_input_size(view_->get_view_size_dips()); |
| 483 input_tracker_.reset( | 484 input_tracker_.reset( |
| 484 new protocol::InputEventTracker(mouse_input_filter_.get())); | 485 new protocol::InputEventTracker(mouse_input_filter_.get())); |
| 485 | 486 |
| 486 #if defined(OS_MACOSX) | 487 #if defined(OS_MACOSX) |
| 487 // On Mac we need an extra filter to inject missing keyup events. | 488 // On Mac we need an extra filter to inject missing keyup events. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 base::WaitableEvent done_event(true, false); | 530 base::WaitableEvent done_event(true, false); |
| 530 client_->Stop(base::Bind(&base::WaitableEvent::Signal, | 531 client_->Stop(base::Bind(&base::WaitableEvent::Signal, |
| 531 base::Unretained(&done_event))); | 532 base::Unretained(&done_event))); |
| 532 done_event.Wait(); | 533 done_event.Wait(); |
| 533 client_.reset(); | 534 client_.reset(); |
| 534 } | 535 } |
| 535 | 536 |
| 536 input_handler_.reset(); | 537 input_handler_.reset(); |
| 537 input_tracker_.reset(); | 538 input_tracker_.reset(); |
| 538 mouse_input_filter_.reset(); | 539 mouse_input_filter_.reset(); |
| 539 audio_player_.reset(); | 540 audio_decode_scheduler_.reset(); |
| 540 host_connection_.reset(); | 541 host_connection_.reset(); |
| 541 } | 542 } |
| 542 | 543 |
| 543 void ChromotingInstance::OnIncomingIq(const std::string& iq) { | 544 void ChromotingInstance::OnIncomingIq(const std::string& iq) { |
| 544 xmpp_proxy_->OnIq(iq); | 545 xmpp_proxy_->OnIq(iq); |
| 545 } | 546 } |
| 546 | 547 |
| 547 void ChromotingInstance::ReleaseAllKeys() { | 548 void ChromotingInstance::ReleaseAllKeys() { |
| 548 if (IsConnected()) | 549 if (IsConnected()) |
| 549 input_tracker_->ReleaseAll(); | 550 input_tracker_->ReleaseAll(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 PostChromotingMessage("logDebugMessage", data.Pass()); | 748 PostChromotingMessage("logDebugMessage", data.Pass()); |
| 748 g_logging_to_plugin = false; | 749 g_logging_to_plugin = false; |
| 749 } | 750 } |
| 750 | 751 |
| 751 bool ChromotingInstance::IsConnected() { | 752 bool ChromotingInstance::IsConnected() { |
| 752 return host_connection_.get() && | 753 return host_connection_.get() && |
| 753 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 754 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
| 754 } | 755 } |
| 755 | 756 |
| 756 } // namespace remoting | 757 } // namespace remoting |
| OLD | NEW |