| 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/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 IPC::PlatformFileForTransit desktop_pipe) { | 218 IPC::PlatformFileForTransit desktop_pipe) { |
| 219 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 219 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 220 DCHECK(!desktop_channel_); | 220 DCHECK(!desktop_channel_); |
| 221 DCHECK(!desktop_process_.IsValid()); | 221 DCHECK(!desktop_process_.IsValid()); |
| 222 | 222 |
| 223 // Ignore the attach notification if the client session has been disconnected | 223 // Ignore the attach notification if the client session has been disconnected |
| 224 // already. | 224 // already. |
| 225 if (!client_session_control_.get()) | 225 if (!client_session_control_.get()) |
| 226 return false; | 226 return false; |
| 227 | 227 |
| 228 desktop_process_ = desktop_process.Pass(); | 228 desktop_process_ = std::move(desktop_process); |
| 229 | 229 |
| 230 #if defined(OS_WIN) | 230 #if defined(OS_WIN) |
| 231 // On Windows: |desktop_process| is a valid handle, but |desktop_pipe| needs | 231 // On Windows: |desktop_process| is a valid handle, but |desktop_pipe| needs |
| 232 // to be duplicated from the desktop process. | 232 // to be duplicated from the desktop process. |
| 233 HANDLE temp_handle; | 233 HANDLE temp_handle; |
| 234 if (!DuplicateHandle(desktop_process_.Handle(), desktop_pipe, | 234 if (!DuplicateHandle(desktop_process_.Handle(), desktop_pipe, |
| 235 GetCurrentProcess(), &temp_handle, 0, | 235 GetCurrentProcess(), &temp_handle, 0, |
| 236 FALSE, DUPLICATE_SAME_ACCESS)) { | 236 FALSE, DUPLICATE_SAME_ACCESS)) { |
| 237 PLOG(ERROR) << "Failed to duplicate the desktop-to-network pipe handle"; | 237 PLOG(ERROR) << "Failed to duplicate the desktop-to-network pipe handle"; |
| 238 | 238 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } | 392 } |
| 393 | 393 |
| 394 SendToDesktop( | 394 SendToDesktop( |
| 395 new ChromotingNetworkDesktopMsg_InjectTouchEvent(serialized_event)); | 395 new ChromotingNetworkDesktopMsg_InjectTouchEvent(serialized_event)); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void DesktopSessionProxy::StartInputInjector( | 398 void DesktopSessionProxy::StartInputInjector( |
| 399 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 399 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
| 400 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 400 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 401 | 401 |
| 402 client_clipboard_ = client_clipboard.Pass(); | 402 client_clipboard_ = std::move(client_clipboard); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void DesktopSessionProxy::SetScreenResolution( | 405 void DesktopSessionProxy::SetScreenResolution( |
| 406 const ScreenResolution& resolution) { | 406 const ScreenResolution& resolution) { |
| 407 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 407 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 408 | 408 |
| 409 if (resolution.IsEmpty()) | 409 if (resolution.IsEmpty()) |
| 410 return; | 410 return; |
| 411 | 411 |
| 412 screen_resolution_ = resolution; | 412 screen_resolution_ = resolution; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 serialized_frame.dimensions, serialized_frame.bytes_per_row, | 511 serialized_frame.dimensions, serialized_frame.bytes_per_row, |
| 512 new IpcSharedBuffer(shared_buffer_core))); | 512 new IpcSharedBuffer(shared_buffer_core))); |
| 513 frame->set_capture_time_ms(serialized_frame.capture_time_ms); | 513 frame->set_capture_time_ms(serialized_frame.capture_time_ms); |
| 514 frame->set_dpi(serialized_frame.dpi); | 514 frame->set_dpi(serialized_frame.dpi); |
| 515 | 515 |
| 516 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { | 516 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { |
| 517 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); | 517 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); |
| 518 } | 518 } |
| 519 | 519 |
| 520 --pending_capture_frame_requests_; | 520 --pending_capture_frame_requests_; |
| 521 PostCaptureCompleted(frame.Pass()); | 521 PostCaptureCompleted(std::move(frame)); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void DesktopSessionProxy::OnMouseCursor( | 524 void DesktopSessionProxy::OnMouseCursor( |
| 525 const webrtc::MouseCursor& mouse_cursor) { | 525 const webrtc::MouseCursor& mouse_cursor) { |
| 526 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 526 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 527 PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); | 527 PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void DesktopSessionProxy::OnInjectClipboardEvent( | 530 void DesktopSessionProxy::OnInjectClipboardEvent( |
| 531 const std::string& serialized_event) { | 531 const std::string& serialized_event) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 573 } |
| 574 | 574 |
| 575 // static | 575 // static |
| 576 void DesktopSessionProxyTraits::Destruct( | 576 void DesktopSessionProxyTraits::Destruct( |
| 577 const DesktopSessionProxy* desktop_session_proxy) { | 577 const DesktopSessionProxy* desktop_session_proxy) { |
| 578 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 578 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 579 desktop_session_proxy); | 579 desktop_session_proxy); |
| 580 } | 580 } |
| 581 | 581 |
| 582 } // namespace remoting | 582 } // namespace remoting |
| OLD | NEW |