Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 10785041: Make Chromoting client plugin always render at device DPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } else if (method == "pauseVideo") { 315 } else if (method == "pauseVideo") {
316 bool pause = false; 316 bool pause = false;
317 if (!data->GetBoolean("pause", &pause)) { 317 if (!data->GetBoolean("pause", &pause)) {
318 LOG(ERROR) << "Invalid pauseVideo."; 318 LOG(ERROR) << "Invalid pauseVideo.";
319 return; 319 return;
320 } 320 }
321 PauseVideo(pause); 321 PauseVideo(pause);
322 } 322 }
323 } 323 }
324 324
325 void ChromotingInstance::DidChangeView(const pp::Rect& position, 325 void ChromotingInstance::DidChangeView(const pp::View& view) {
326 const pp::Rect& clip) {
327 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 326 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
328 327
329 SkISize new_size = SkISize::Make(position.width(), position.height()); 328 view_->SetView(view);
330 SkIRect new_clip =
331 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height());
332
333 view_->SetView(new_size, new_clip);
334 329
335 if (mouse_input_filter_.get()) { 330 if (mouse_input_filter_.get()) {
336 mouse_input_filter_->set_input_size(view_->get_view_size()); 331 mouse_input_filter_->set_input_size(view_->get_view_size_dips());
Sergey Ulanov 2012/07/17 19:36:06 Do we always send mouse position in DIPs?
Wez 2012/07/17 20:11:43 We will always receive them from Pepper in DIPs, y
337 } 332 }
338 } 333 }
339 334
340 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { 335 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
341 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 336 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
342 337
343 if (!IsConnected()) 338 if (!IsConnected())
344 return false; 339 return false;
345 340
346 // TODO(wez): When we have a good hook into Host dimensions changes, move 341 // TODO(wez): When we have a good hook into Host dimensions changes, move
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 375
381 host_connection_.reset(new protocol::ConnectionToHost(true)); 376 host_connection_.reset(new protocol::ConnectionToHost(true));
382 client_.reset(new ChromotingClient(config, context_.main_task_runner(), 377 client_.reset(new ChromotingClient(config, context_.main_task_runner(),
383 host_connection_.get(), view_.get(), 378 host_connection_.get(), view_.get(),
384 rectangle_decoder_.get(), 379 rectangle_decoder_.get(),
385 audio_player_.get())); 380 audio_player_.get()));
386 381
387 // Construct the input pipeline 382 // Construct the input pipeline
388 mouse_input_filter_.reset( 383 mouse_input_filter_.reset(
389 new protocol::MouseInputFilter(host_connection_->input_stub())); 384 new protocol::MouseInputFilter(host_connection_->input_stub()));
390 mouse_input_filter_->set_input_size(view_->get_view_size()); 385 mouse_input_filter_->set_input_size(view_->get_view_size_dips());
391 input_tracker_.reset( 386 input_tracker_.reset(
392 new protocol::InputEventTracker(mouse_input_filter_.get())); 387 new protocol::InputEventTracker(mouse_input_filter_.get()));
393 388
394 #if defined(OS_MACOSX) 389 #if defined(OS_MACOSX)
395 // On Mac we need an extra filter to inject missing keyup events. 390 // On Mac we need an extra filter to inject missing keyup events.
396 // See remoting/client/plugin/mac_key_event_processor.h for more details. 391 // See remoting/client/plugin/mac_key_event_processor.h for more details.
397 mac_key_event_processor_.reset( 392 mac_key_event_processor_.reset(
398 new MacKeyEventProcessor(input_tracker_.get())); 393 new MacKeyEventProcessor(input_tracker_.get()));
399 key_mapper_.set_input_stub(mac_key_event_processor_.get()); 394 key_mapper_.set_input_stub(mac_key_event_processor_.get());
400 #else 395 #else
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 PostChromotingMessage("logDebugMessage", data.Pass()); 705 PostChromotingMessage("logDebugMessage", data.Pass());
711 g_logging_to_plugin = false; 706 g_logging_to_plugin = false;
712 } 707 }
713 708
714 bool ChromotingInstance::IsConnected() { 709 bool ChromotingInstance::IsConnected() {
715 return host_connection_.get() && 710 return host_connection_.get() &&
716 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 711 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
717 } 712 }
718 713
719 } // namespace remoting 714 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698