| 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/host/desktop_session_proxy.h" | 5 #include "remoting/host/desktop_session_proxy.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 return scoped_ptr<InputInjector>(new IpcInputInjector(this)); | 131 return scoped_ptr<InputInjector>(new IpcInputInjector(this)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 scoped_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() { | 134 scoped_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() { |
| 135 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 135 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 136 | 136 |
| 137 return scoped_ptr<ScreenControls>(new IpcScreenControls(this)); | 137 return scoped_ptr<ScreenControls>(new IpcScreenControls(this)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 scoped_ptr<media::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() { | 140 scoped_ptr<webrtc::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() { |
| 141 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 141 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 142 | 142 |
| 143 return scoped_ptr<media::ScreenCapturer>(new IpcVideoFrameCapturer(this)); | 143 return scoped_ptr<webrtc::ScreenCapturer>(new IpcVideoFrameCapturer(this)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::string DesktopSessionProxy::GetCapabilities() const { | 146 std::string DesktopSessionProxy::GetCapabilities() const { |
| 147 // Ask the client to send it's resolution unconditionally. | 147 // Ask the client to send it's resolution unconditionally. |
| 148 return virtual_terminal_ ? kSendInitialResolution : std::string(); | 148 return virtual_terminal_ ? kSendInitialResolution : std::string(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { | 151 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { |
| 152 // Delay creation of the desktop session until the client screen resolution is | 152 // Delay creation of the desktop session until the client screen resolution is |
| 153 // received if the desktop session requires the initial screen resolution | 153 // received if the desktop session requires the initial screen resolution |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { | 481 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { |
| 482 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); | 482 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); |
| 483 } | 483 } |
| 484 | 484 |
| 485 --pending_capture_frame_requests_; | 485 --pending_capture_frame_requests_; |
| 486 PostCaptureCompleted(frame.Pass()); | 486 PostCaptureCompleted(frame.Pass()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void DesktopSessionProxy::OnCursorShapeChanged( | 489 void DesktopSessionProxy::OnCursorShapeChanged( |
| 490 const media::MouseCursorShape& cursor_shape) { | 490 const webrtc::MouseCursorShape& cursor_shape) { |
| 491 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 491 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 492 PostCursorShape(scoped_ptr<media::MouseCursorShape>( | 492 PostCursorShape(scoped_ptr<webrtc::MouseCursorShape>( |
| 493 new media::MouseCursorShape(cursor_shape))); | 493 new webrtc::MouseCursorShape(cursor_shape))); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void DesktopSessionProxy::OnInjectClipboardEvent( | 496 void DesktopSessionProxy::OnInjectClipboardEvent( |
| 497 const std::string& serialized_event) { | 497 const std::string& serialized_event) { |
| 498 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 498 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 499 | 499 |
| 500 if (client_clipboard_) { | 500 if (client_clipboard_) { |
| 501 protocol::ClipboardEvent event; | 501 protocol::ClipboardEvent event; |
| 502 if (!event.ParseFromString(serialized_event)) { | 502 if (!event.ParseFromString(serialized_event)) { |
| 503 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; | 503 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; |
| 504 return; | 504 return; |
| 505 } | 505 } |
| 506 | 506 |
| 507 client_clipboard_->InjectClipboardEvent(event); | 507 client_clipboard_->InjectClipboardEvent(event); |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 void DesktopSessionProxy::PostCaptureCompleted( | 511 void DesktopSessionProxy::PostCaptureCompleted( |
| 512 scoped_ptr<webrtc::DesktopFrame> frame) { | 512 scoped_ptr<webrtc::DesktopFrame> frame) { |
| 513 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 513 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 514 | 514 |
| 515 video_capture_task_runner_->PostTask( | 515 video_capture_task_runner_->PostTask( |
| 516 FROM_HERE, | 516 FROM_HERE, |
| 517 base::Bind(&IpcVideoFrameCapturer::OnCaptureCompleted, video_capturer_, | 517 base::Bind(&IpcVideoFrameCapturer::OnCaptureCompleted, video_capturer_, |
| 518 base::Passed(&frame))); | 518 base::Passed(&frame))); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void DesktopSessionProxy::PostCursorShape( | 521 void DesktopSessionProxy::PostCursorShape( |
| 522 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 522 scoped_ptr<webrtc::MouseCursorShape> cursor_shape) { |
| 523 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 523 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 524 | 524 |
| 525 video_capture_task_runner_->PostTask( | 525 video_capture_task_runner_->PostTask( |
| 526 FROM_HERE, | 526 FROM_HERE, |
| 527 base::Bind(&IpcVideoFrameCapturer::OnCursorShapeChanged, video_capturer_, | 527 base::Bind(&IpcVideoFrameCapturer::OnCursorShapeChanged, video_capturer_, |
| 528 base::Passed(&cursor_shape))); | 528 base::Passed(&cursor_shape))); |
| 529 } | 529 } |
| 530 | 530 |
| 531 void DesktopSessionProxy::SendToDesktop(IPC::Message* message) { | 531 void DesktopSessionProxy::SendToDesktop(IPC::Message* message) { |
| 532 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 532 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 533 | 533 |
| 534 if (desktop_channel_) { | 534 if (desktop_channel_) { |
| 535 desktop_channel_->Send(message); | 535 desktop_channel_->Send(message); |
| 536 } else { | 536 } else { |
| 537 delete message; | 537 delete message; |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 // static | 541 // static |
| 542 void DesktopSessionProxyTraits::Destruct( | 542 void DesktopSessionProxyTraits::Destruct( |
| 543 const DesktopSessionProxy* desktop_session_proxy) { | 543 const DesktopSessionProxy* desktop_session_proxy) { |
| 544 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 544 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 545 desktop_session_proxy); | 545 desktop_session_proxy); |
| 546 } | 546 } |
| 547 | 547 |
| 548 } // namespace remoting | 548 } // namespace remoting |
| OLD | NEW |