Chromium Code Reviews| 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 #if defined(OS_NACL) | 10 #if defined(OS_NACL) |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "remoting/base/constants.h" | 37 #include "remoting/base/constants.h" |
| 38 #include "remoting/base/util.h" | 38 #include "remoting/base/util.h" |
| 39 #include "remoting/client/chromoting_client.h" | 39 #include "remoting/client/chromoting_client.h" |
| 40 #include "remoting/client/plugin/delegating_signal_strategy.h" | 40 #include "remoting/client/plugin/delegating_signal_strategy.h" |
| 41 #include "remoting/client/plugin/normalizing_input_filter_cros.h" | 41 #include "remoting/client/plugin/normalizing_input_filter_cros.h" |
| 42 #include "remoting/client/plugin/normalizing_input_filter_mac.h" | 42 #include "remoting/client/plugin/normalizing_input_filter_mac.h" |
| 43 #include "remoting/client/plugin/pepper_audio_player.h" | 43 #include "remoting/client/plugin/pepper_audio_player.h" |
| 44 #include "remoting/client/plugin/pepper_mouse_locker.h" | 44 #include "remoting/client/plugin/pepper_mouse_locker.h" |
| 45 #include "remoting/client/plugin/pepper_port_allocator.h" | 45 #include "remoting/client/plugin/pepper_port_allocator.h" |
| 46 #include "remoting/client/plugin/pepper_video_renderer_2d.h" | 46 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 47 #include "remoting/client/plugin/pepper_video_renderer_3d.h" | |
| 47 #include "remoting/client/software_video_renderer.h" | 48 #include "remoting/client/software_video_renderer.h" |
| 48 #include "remoting/client/token_fetcher_proxy.h" | 49 #include "remoting/client/token_fetcher_proxy.h" |
| 49 #include "remoting/protocol/connection_to_host.h" | 50 #include "remoting/protocol/connection_to_host.h" |
| 50 #include "remoting/protocol/host_stub.h" | 51 #include "remoting/protocol/host_stub.h" |
| 51 #include "remoting/protocol/libjingle_transport_factory.h" | 52 #include "remoting/protocol/libjingle_transport_factory.h" |
| 52 #include "third_party/webrtc/base/helpers.h" | 53 #include "third_party/webrtc/base/helpers.h" |
| 53 #include "third_party/webrtc/base/ssladapter.h" | 54 #include "third_party/webrtc/base/ssladapter.h" |
| 54 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| 55 | 56 |
| 56 // Windows defines 'PostMessage', so we have to undef it. | 57 // Windows defines 'PostMessage', so we have to undef it. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 | 377 |
| 377 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { | 378 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { |
| 378 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 379 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 379 | 380 |
| 380 if (!IsConnected()) | 381 if (!IsConnected()) |
| 381 return false; | 382 return false; |
| 382 | 383 |
| 383 return input_handler_.HandleInputEvent(event); | 384 return input_handler_.HandleInputEvent(event); |
| 384 } | 385 } |
| 385 | 386 |
| 387 void ChromotingInstance::OnVideoDecoderFailed() { | |
| 388 mouse_input_filter_.set_input_stub(NULL); | |
| 389 client_.reset(); | |
| 390 video_renderer_.reset(); | |
| 391 | |
| 392 OnConnectionState(protocol::ConnectionToHost::FAILED, | |
| 393 protocol::INCOMPATIBLE_PROTOCOL); | |
|
Wez
2014/12/24 17:11:13
This seems a strange error to set in case of decod
Sergey Ulanov
2015/01/06 01:16:31
Added TODO to fix it.
| |
| 394 } | |
| 395 | |
| 386 void ChromotingInstance::OnVideoFirstFrameReceived() { | 396 void ChromotingInstance::OnVideoFirstFrameReceived() { |
| 387 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 397 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 388 PostLegacyJsonMessage("onFirstFrameReceived", data.Pass()); | 398 PostLegacyJsonMessage("onFirstFrameReceived", data.Pass()); |
| 389 } | 399 } |
| 390 | 400 |
| 391 void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, | 401 void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, |
| 392 const webrtc::DesktopVector& dpi) { | 402 const webrtc::DesktopVector& dpi) { |
| 393 mouse_input_filter_.set_output_size(size); | 403 mouse_input_filter_.set_output_size(size); |
| 394 | 404 |
| 395 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 405 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 } | 627 } |
| 618 #elif defined(OS_MACOSX) | 628 #elif defined(OS_MACOSX) |
| 619 normalizing_input_filter_.reset(new NormalizingInputFilterMac(&key_mapper_)); | 629 normalizing_input_filter_.reset(new NormalizingInputFilterMac(&key_mapper_)); |
| 620 #elif defined(OS_CHROMEOS) | 630 #elif defined(OS_CHROMEOS) |
| 621 normalizing_input_filter_.reset(new NormalizingInputFilterCros(&key_mapper_)); | 631 normalizing_input_filter_.reset(new NormalizingInputFilterCros(&key_mapper_)); |
| 622 #else | 632 #else |
| 623 normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_)); | 633 normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_)); |
| 624 #endif | 634 #endif |
| 625 input_handler_.set_input_stub(normalizing_input_filter_.get()); | 635 input_handler_.set_input_stub(normalizing_input_filter_.get()); |
| 626 | 636 |
| 627 video_renderer_.reset(new PepperVideoRenderer2D()); | 637 video_renderer_.reset(new PepperVideoRenderer3D()); |
| 628 bool initialized = | 638 bool initialized = |
|
Wez
2014/12/24 17:11:13
Rather than have this bool, it'd be more readable
Sergey Ulanov
2015/01/06 01:16:31
Done.
| |
| 629 video_renderer_->Initialize(this, context_, this); | 639 video_renderer_->Initialize(this, context_, this); |
| 630 CHECK(initialized); | 640 |
| 641 // If we failed to initialize 3D renderer (because there is no hardware | |
| 642 // support on this machine) then use the 2D renderer. | |
| 643 if (!initialized) { | |
| 644 LOG(WARNING) | |
| 645 << "Failed to initialize 3D renderer. Using 2D renderer instead."; | |
| 646 video_renderer_.reset(new PepperVideoRenderer2D()); | |
| 647 bool initialized = | |
| 648 video_renderer_->Initialize(this, context_, this); | |
| 649 CHECK(initialized); | |
|
Wez
2014/12/24 17:11:13
Move this CHECK to after the if() block
Sergey Ulanov
2015/01/06 01:16:31
Done.
| |
| 650 } | |
| 631 | 651 |
| 632 if (!plugin_view_.is_null()) | 652 if (!plugin_view_.is_null()) |
| 633 video_renderer_->OnViewChanged(plugin_view_); | 653 video_renderer_->OnViewChanged(plugin_view_); |
| 634 | 654 |
| 635 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); | 655 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); |
| 636 client_.reset(new ChromotingClient(&context_, this, video_renderer_.get(), | 656 client_.reset(new ChromotingClient(&context_, this, video_renderer_.get(), |
| 637 audio_player.Pass())); | 657 audio_player.Pass())); |
| 638 | 658 |
| 639 // Connect the input pipeline to the protocol stub & initialize components. | 659 // Connect the input pipeline to the protocol stub & initialize components. |
| 640 mouse_input_filter_.set_input_stub(client_->input_stub()); | 660 mouse_input_filter_.set_input_stub(client_->input_stub()); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 url_components.scheme.len); | 1116 url_components.scheme.len); |
| 1097 return url_scheme == kChromeExtensionUrlScheme; | 1117 return url_scheme == kChromeExtensionUrlScheme; |
| 1098 } | 1118 } |
| 1099 | 1119 |
| 1100 bool ChromotingInstance::IsConnected() { | 1120 bool ChromotingInstance::IsConnected() { |
| 1101 return client_ && | 1121 return client_ && |
| 1102 (client_->connection_state() == protocol::ConnectionToHost::CONNECTED); | 1122 (client_->connection_state() == protocol::ConnectionToHost::CONNECTED); |
| 1103 } | 1123 } |
| 1104 | 1124 |
| 1105 } // namespace remoting | 1125 } // namespace remoting |
| OLD | NEW |