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 <nacl_io/nacl_io.h> | 7 #include <nacl_io/nacl_io.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // error was caused by some other problem. | 334 // error was caused by some other problem. |
335 OnConnectionState(protocol::ConnectionToHost::FAILED, | 335 OnConnectionState(protocol::ConnectionToHost::FAILED, |
336 protocol::INCOMPATIBLE_PROTOCOL); | 336 protocol::INCOMPATIBLE_PROTOCOL); |
337 } | 337 } |
338 | 338 |
339 void ChromotingInstance::OnVideoFirstFrameReceived() { | 339 void ChromotingInstance::OnVideoFirstFrameReceived() { |
340 PostLegacyJsonMessage("onFirstFrameReceived", | 340 PostLegacyJsonMessage("onFirstFrameReceived", |
341 make_scoped_ptr(new base::DictionaryValue())); | 341 make_scoped_ptr(new base::DictionaryValue())); |
342 } | 342 } |
343 | 343 |
344 void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, | |
345 const webrtc::DesktopVector& dpi) { | |
346 mouse_input_filter_.set_output_size(size); | |
347 touch_input_scaler_.set_output_size(size); | |
348 | |
349 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | |
350 data->SetInteger("width", size.width()); | |
351 data->SetInteger("height", size.height()); | |
352 if (dpi.x()) | |
353 data->SetInteger("x_dpi", dpi.x()); | |
354 if (dpi.y()) | |
355 data->SetInteger("y_dpi", dpi.y()); | |
356 PostLegacyJsonMessage("onDesktopSize", std::move(data)); | |
357 } | |
358 | |
359 void ChromotingInstance::OnVideoFrameDirtyRegion( | 344 void ChromotingInstance::OnVideoFrameDirtyRegion( |
360 const webrtc::DesktopRegion& dirty_region) { | 345 const webrtc::DesktopRegion& dirty_region) { |
361 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); | 346 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); |
362 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd(); | 347 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd(); |
363 i.Advance()) { | 348 i.Advance()) { |
364 const webrtc::DesktopRect& rect = i.rect(); | 349 const webrtc::DesktopRect& rect = i.rect(); |
365 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); | 350 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); |
366 rect_value->AppendInteger(rect.left()); | 351 rect_value->AppendInteger(rect.left()); |
367 rect_value->AppendInteger(rect.top()); | 352 rect_value->AppendInteger(rect.top()); |
368 rect_value->AppendInteger(rect.width()); | 353 rect_value->AppendInteger(rect.width()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 } | 467 } |
483 | 468 |
484 void ChromotingInstance::DeliverHostMessage( | 469 void ChromotingInstance::DeliverHostMessage( |
485 const protocol::ExtensionMessage& message) { | 470 const protocol::ExtensionMessage& message) { |
486 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 471 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
487 data->SetString("type", message.type()); | 472 data->SetString("type", message.type()); |
488 data->SetString("data", message.data()); | 473 data->SetString("data", message.data()); |
489 PostLegacyJsonMessage("extensionMessage", std::move(data)); | 474 PostLegacyJsonMessage("extensionMessage", std::move(data)); |
490 } | 475 } |
491 | 476 |
| 477 void ChromotingInstance::SetDesktopSize(const webrtc::DesktopSize& size, |
| 478 const webrtc::DesktopVector& dpi) { |
| 479 DCHECK(!dpi.is_zero()); |
| 480 |
| 481 mouse_input_filter_.set_output_size(size); |
| 482 touch_input_scaler_.set_output_size(size); |
| 483 |
| 484 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 485 data->SetInteger("width", size.width()); |
| 486 data->SetInteger("height", size.height()); |
| 487 data->SetInteger("x_dpi", dpi.x()); |
| 488 data->SetInteger("y_dpi", dpi.y()); |
| 489 PostLegacyJsonMessage("onDesktopSize", std::move(data)); |
| 490 } |
| 491 |
492 void ChromotingInstance::FetchSecretFromDialog( | 492 void ChromotingInstance::FetchSecretFromDialog( |
493 bool pairing_supported, | 493 bool pairing_supported, |
494 const protocol::SecretFetchedCallback& secret_fetched_callback) { | 494 const protocol::SecretFetchedCallback& secret_fetched_callback) { |
495 // Once the Session object calls this function, it won't continue the | 495 // Once the Session object calls this function, it won't continue the |
496 // authentication until the callback is called (or connection is canceled). | 496 // authentication until the callback is called (or connection is canceled). |
497 // So, it's impossible to reach this with a callback already registered. | 497 // So, it's impossible to reach this with a callback already registered. |
498 DCHECK(secret_fetched_callback_.is_null()); | 498 DCHECK(secret_fetched_callback_.is_null()); |
499 secret_fetched_callback_ = secret_fetched_callback; | 499 secret_fetched_callback_ = secret_fetched_callback; |
500 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 500 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
501 data->SetBoolean("pairingSupported", pairing_supported); | 501 data->SetBoolean("pairingSupported", pairing_supported); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 if (is_custom_counts_histogram) { | 1113 if (is_custom_counts_histogram) { |
1114 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1114 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
1115 histogram_max, histogram_buckets); | 1115 histogram_max, histogram_buckets); |
1116 } else { | 1116 } else { |
1117 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1117 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
1118 histogram_max, histogram_buckets); | 1118 histogram_max, histogram_buckets); |
1119 } | 1119 } |
1120 } | 1120 } |
1121 | 1121 |
1122 } // namespace remoting | 1122 } // namespace remoting |
OLD | NEW |