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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } else if (method == "pauseVideo") { | 334 } else if (method == "pauseVideo") { |
335 bool pause = false; | 335 bool pause = false; |
336 if (!data->GetBoolean("pause", &pause)) { | 336 if (!data->GetBoolean("pause", &pause)) { |
337 LOG(ERROR) << "Invalid pauseVideo."; | 337 LOG(ERROR) << "Invalid pauseVideo."; |
338 return; | 338 return; |
339 } | 339 } |
340 PauseVideo(pause); | 340 PauseVideo(pause); |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 void ChromotingInstance::DidChangeView(const pp::Rect& position, | 344 void ChromotingInstance::DidChangeView(const pp::View& view) { |
345 const pp::Rect& clip) { | |
346 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | 345 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); |
347 | 346 |
348 SkISize new_size = SkISize::Make(position.width(), position.height()); | 347 view_->SetView(view); |
349 SkIRect new_clip = | |
350 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()); | |
351 | |
352 view_->SetView(new_size, new_clip); | |
353 | 348 |
354 if (mouse_input_filter_.get()) { | 349 if (mouse_input_filter_.get()) { |
355 mouse_input_filter_->set_input_size(view_->get_view_size()); | 350 mouse_input_filter_->set_input_size(view_->get_view_size_dips()); |
356 } | 351 } |
357 } | 352 } |
358 | 353 |
359 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { | 354 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { |
360 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | 355 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); |
361 | 356 |
362 if (!IsConnected()) | 357 if (!IsConnected()) |
363 return false; | 358 return false; |
364 | 359 |
365 // TODO(wez): When we have a good hook into Host dimensions changes, move | 360 // TODO(wez): When we have a good hook into Host dimensions changes, move |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 host_connection_.reset(new protocol::ConnectionToHost(true)); | 472 host_connection_.reset(new protocol::ConnectionToHost(true)); |
478 audio_player_.reset(new PepperAudioPlayer(this)); | 473 audio_player_.reset(new PepperAudioPlayer(this)); |
479 client_.reset(new ChromotingClient(config, context_.main_task_runner(), | 474 client_.reset(new ChromotingClient(config, context_.main_task_runner(), |
480 host_connection_.get(), this, | 475 host_connection_.get(), this, |
481 rectangle_decoder_.get(), | 476 rectangle_decoder_.get(), |
482 audio_player_.get())); | 477 audio_player_.get())); |
483 | 478 |
484 // Construct the input pipeline | 479 // Construct the input pipeline |
485 mouse_input_filter_.reset( | 480 mouse_input_filter_.reset( |
486 new protocol::MouseInputFilter(host_connection_->input_stub())); | 481 new protocol::MouseInputFilter(host_connection_->input_stub())); |
487 mouse_input_filter_->set_input_size(view_->get_view_size()); | 482 mouse_input_filter_->set_input_size(view_->get_view_size_dips()); |
488 input_tracker_.reset( | 483 input_tracker_.reset( |
489 new protocol::InputEventTracker(mouse_input_filter_.get())); | 484 new protocol::InputEventTracker(mouse_input_filter_.get())); |
490 | 485 |
491 #if defined(OS_MACOSX) | 486 #if defined(OS_MACOSX) |
492 // On Mac we need an extra filter to inject missing keyup events. | 487 // On Mac we need an extra filter to inject missing keyup events. |
493 // See remoting/client/plugin/mac_key_event_processor.h for more details. | 488 // See remoting/client/plugin/mac_key_event_processor.h for more details. |
494 mac_key_event_processor_.reset( | 489 mac_key_event_processor_.reset( |
495 new MacKeyEventProcessor(input_tracker_.get())); | 490 new MacKeyEventProcessor(input_tracker_.get())); |
496 key_mapper_.set_input_stub(mac_key_event_processor_.get()); | 491 key_mapper_.set_input_stub(mac_key_event_processor_.get()); |
497 #else | 492 #else |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 PostChromotingMessage("logDebugMessage", data.Pass()); | 747 PostChromotingMessage("logDebugMessage", data.Pass()); |
753 g_logging_to_plugin = false; | 748 g_logging_to_plugin = false; |
754 } | 749 } |
755 | 750 |
756 bool ChromotingInstance::IsConnected() { | 751 bool ChromotingInstance::IsConnected() { |
757 return host_connection_.get() && | 752 return host_connection_.get() && |
758 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 753 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
759 } | 754 } |
760 | 755 |
761 } // namespace remoting | 756 } // namespace remoting |
OLD | NEW |