| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "remoting/client/plugin/pepper_port_allocator_factory.h" | 49 #include "remoting/client/plugin/pepper_port_allocator_factory.h" |
| 50 #include "remoting/client/plugin/pepper_url_request.h" | 50 #include "remoting/client/plugin/pepper_url_request.h" |
| 51 #include "remoting/client/plugin/pepper_video_renderer_2d.h" | 51 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 52 #include "remoting/client/plugin/pepper_video_renderer_3d.h" | 52 #include "remoting/client/plugin/pepper_video_renderer_3d.h" |
| 53 #include "remoting/client/software_video_renderer.h" | 53 #include "remoting/client/software_video_renderer.h" |
| 54 #include "remoting/proto/control.pb.h" | 54 #include "remoting/proto/control.pb.h" |
| 55 #include "remoting/protocol/connection_to_host.h" | 55 #include "remoting/protocol/connection_to_host.h" |
| 56 #include "remoting/protocol/host_stub.h" | 56 #include "remoting/protocol/host_stub.h" |
| 57 #include "remoting/protocol/transport_context.h" | 57 #include "remoting/protocol/transport_context.h" |
| 58 #include "third_party/webrtc/base/helpers.h" | 58 #include "third_party/webrtc/base/helpers.h" |
| 59 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
| 59 #include "url/gurl.h" | 60 #include "url/gurl.h" |
| 60 | 61 |
| 61 namespace remoting { | 62 namespace remoting { |
| 62 | 63 |
| 63 namespace { | 64 namespace { |
| 64 | 65 |
| 65 // Default DPI to assume for old clients that use notifyClientResolution. | 66 // Default DPI to assume for old clients that use notifyClientResolution. |
| 66 const int kDefaultDPI = 96; | 67 const int kDefaultDPI = 96; |
| 67 | 68 |
| 68 // Size of the random seed blob used to initialize RNG in libjingle. OpenSSL | 69 // Size of the random seed blob used to initialize RNG in libjingle. OpenSSL |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 349 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| 349 data->SetInteger("width", size.width()); | 350 data->SetInteger("width", size.width()); |
| 350 data->SetInteger("height", size.height()); | 351 data->SetInteger("height", size.height()); |
| 351 if (dpi.x()) | 352 if (dpi.x()) |
| 352 data->SetInteger("x_dpi", dpi.x()); | 353 data->SetInteger("x_dpi", dpi.x()); |
| 353 if (dpi.y()) | 354 if (dpi.y()) |
| 354 data->SetInteger("y_dpi", dpi.y()); | 355 data->SetInteger("y_dpi", dpi.y()); |
| 355 PostLegacyJsonMessage("onDesktopSize", std::move(data)); | 356 PostLegacyJsonMessage("onDesktopSize", std::move(data)); |
| 356 } | 357 } |
| 357 | 358 |
| 358 void ChromotingInstance::OnVideoShape(const webrtc::DesktopRegion* shape) { | |
| 359 if ((shape && desktop_shape_ && shape->Equals(*desktop_shape_)) || | |
| 360 (!shape && !desktop_shape_)) { | |
| 361 return; | |
| 362 } | |
| 363 | |
| 364 scoped_ptr<base::DictionaryValue> shape_message(new base::DictionaryValue()); | |
| 365 if (shape) { | |
| 366 desktop_shape_ = make_scoped_ptr(new webrtc::DesktopRegion(*shape)); | |
| 367 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); | |
| 368 for (webrtc::DesktopRegion::Iterator i(*shape); !i.IsAtEnd(); i.Advance()) { | |
| 369 const webrtc::DesktopRect& rect = i.rect(); | |
| 370 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); | |
| 371 rect_value->AppendInteger(rect.left()); | |
| 372 rect_value->AppendInteger(rect.top()); | |
| 373 rect_value->AppendInteger(rect.width()); | |
| 374 rect_value->AppendInteger(rect.height()); | |
| 375 rects_value->Append(rect_value.release()); | |
| 376 } | |
| 377 shape_message->Set("rects", rects_value.release()); | |
| 378 } | |
| 379 | |
| 380 PostLegacyJsonMessage("onDesktopShape", std::move(shape_message)); | |
| 381 } | |
| 382 | |
| 383 void ChromotingInstance::OnVideoFrameDirtyRegion( | 359 void ChromotingInstance::OnVideoFrameDirtyRegion( |
| 384 const webrtc::DesktopRegion& dirty_region) { | 360 const webrtc::DesktopRegion& dirty_region) { |
| 385 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); | 361 scoped_ptr<base::ListValue> rects_value(new base::ListValue()); |
| 386 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd(); | 362 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd(); |
| 387 i.Advance()) { | 363 i.Advance()) { |
| 388 const webrtc::DesktopRect& rect = i.rect(); | 364 const webrtc::DesktopRect& rect = i.rect(); |
| 389 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); | 365 scoped_ptr<base::ListValue> rect_value(new base::ListValue()); |
| 390 rect_value->AppendInteger(rect.left()); | 366 rect_value->AppendInteger(rect.left()); |
| 391 rect_value->AppendInteger(rect.top()); | 367 rect_value->AppendInteger(rect.top()); |
| 392 rect_value->AppendInteger(rect.width()); | 368 rect_value->AppendInteger(rect.width()); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 if (is_custom_counts_histogram) { | 1113 if (is_custom_counts_histogram) { |
| 1138 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1114 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
| 1139 histogram_max, histogram_buckets); | 1115 histogram_max, histogram_buckets); |
| 1140 } else { | 1116 } else { |
| 1141 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1117 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
| 1142 histogram_max, histogram_buckets); | 1118 histogram_max, histogram_buckets); |
| 1143 } | 1119 } |
| 1144 } | 1120 } |
| 1145 | 1121 |
| 1146 } // namespace remoting | 1122 } // namespace remoting |
| OLD | NEW |