| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { | 345 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { |
| 346 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 346 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 347 | 347 |
| 348 if (!IsConnected()) | 348 if (!IsConnected()) |
| 349 return false; | 349 return false; |
| 350 | 350 |
| 351 return input_handler_.HandleInputEvent(event); | 351 return input_handler_.HandleInputEvent(event); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void ChromotingInstance::SetDesktopSize(const SkISize& size, | 354 void ChromotingInstance::SetDesktopSize(const webrtc::DesktopSize& size, |
| 355 const SkIPoint& dpi) { | 355 const webrtc::DesktopVector& dpi) { |
| 356 mouse_input_filter_.set_output_size(size); | 356 mouse_input_filter_.set_output_size(size); |
| 357 | 357 |
| 358 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 358 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 359 data->SetInteger("width", size.width()); | 359 data->SetInteger("width", size.width()); |
| 360 data->SetInteger("height", size.height()); | 360 data->SetInteger("height", size.height()); |
| 361 if (dpi.x()) | 361 if (dpi.x()) |
| 362 data->SetInteger("x_dpi", dpi.x()); | 362 data->SetInteger("x_dpi", dpi.x()); |
| 363 if (dpi.y()) | 363 if (dpi.y()) |
| 364 data->SetInteger("y_dpi", dpi.y()); | 364 data->SetInteger("y_dpi", dpi.y()); |
| 365 PostChromotingMessage("onDesktopSize", data.Pass()); | 365 PostChromotingMessage("onDesktopSize", data.Pass()); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void ChromotingInstance::SetDesktopShape(const SkRegion& shape) { | 368 void ChromotingInstance::SetDesktopShape(const webrtc::DesktopRegion& shape) { |
| 369 if (desktop_shape_ && shape == *desktop_shape_) | 369 if (desktop_shape_ && shape.Equals(*desktop_shape_)) |
| 370 return; | 370 return; |
| 371 | 371 |
| 372 desktop_shape_.reset(new SkRegion(shape)); | 372 desktop_shape_.reset(new webrtc::DesktopRegion(shape)); |
| 373 | 373 |
| 374 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); | 374 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); |
| 375 for (SkRegion::Iterator i(shape); !i.done(); i.next()) { | 375 for (webrtc::DesktopRegion::Iterator i(shape); !i.IsAtEnd(); i.Advance()) { |
| 376 SkIRect rect = i.rect(); | 376 const webrtc::DesktopRect& rect = i.rect(); |
| 377 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); | 377 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); |
| 378 rect_value->AppendInteger(rect.x()); | 378 rect_value->AppendInteger(rect.left()); |
| 379 rect_value->AppendInteger(rect.y()); | 379 rect_value->AppendInteger(rect.top()); |
| 380 rect_value->AppendInteger(rect.width()); | 380 rect_value->AppendInteger(rect.width()); |
| 381 rect_value->AppendInteger(rect.height()); | 381 rect_value->AppendInteger(rect.height()); |
| 382 rects_value->Append(rect_value.release()); | 382 rects_value->Append(rect_value.release()); |
| 383 } | 383 } |
| 384 | 384 |
| 385 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 385 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 386 data->Set("rects", rects_value.release()); | 386 data->Set("rects", rects_value.release()); |
| 387 PostChromotingMessage("onDesktopShape", data.Pass()); | 387 PostChromotingMessage("onDesktopShape", data.Pass()); |
| 388 } | 388 } |
| 389 | 389 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 url_components.scheme.len); | 1043 url_components.scheme.len); |
| 1044 return url_scheme == kChromeExtensionUrlScheme; | 1044 return url_scheme == kChromeExtensionUrlScheme; |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 bool ChromotingInstance::IsConnected() { | 1047 bool ChromotingInstance::IsConnected() { |
| 1048 return host_connection_.get() && | 1048 return host_connection_.get() && |
| 1049 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 1049 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 } // namespace remoting | 1052 } // namespace remoting |
| OLD | NEW |