| 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" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_channel_proxy.h" |
| 13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "remoting/base/capabilities.h" | 14 #include "remoting/base/capabilities.h" |
| 15 #include "remoting/host/chromoting_messages.h" | 15 #include "remoting/host/chromoting_messages.h" |
| 16 #include "remoting/host/client_session.h" | 16 #include "remoting/host/client_session.h" |
| 17 #include "remoting/host/client_session_control.h" | 17 #include "remoting/host/client_session_control.h" |
| 18 #include "remoting/host/desktop_session_connector.h" | 18 #include "remoting/host/desktop_session_connector.h" |
| 19 #include "remoting/host/ipc_audio_capturer.h" | 19 #include "remoting/host/ipc_audio_capturer.h" |
| 20 #include "remoting/host/ipc_input_injector.h" | 20 #include "remoting/host/ipc_input_injector.h" |
| 21 #include "remoting/host/ipc_mouse_cursor_monitor.h" | 21 #include "remoting/host/ipc_mouse_cursor_monitor.h" |
| 22 #include "remoting/host/ipc_screen_controls.h" | 22 #include "remoting/host/ipc_screen_controls.h" |
| 23 #include "remoting/host/ipc_video_frame_capturer.h" | 23 #include "remoting/host/ipc_video_frame_capturer.h" |
| 24 #include "remoting/host/multi_touch_capability.h" |
| 24 #include "remoting/proto/audio.pb.h" | 25 #include "remoting/proto/audio.pb.h" |
| 25 #include "remoting/proto/control.pb.h" | 26 #include "remoting/proto/control.pb.h" |
| 26 #include "remoting/proto/event.pb.h" | 27 #include "remoting/proto/event.pb.h" |
| 27 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 28 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| 28 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 29 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 29 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" | 30 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" |
| 30 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" | 31 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" |
| 31 | 32 |
| 32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 33 #include "base/win/scoped_handle.h" | 34 #include "base/win/scoped_handle.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); | 101 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 DesktopSessionProxy::DesktopSessionProxy( | 104 DesktopSessionProxy::DesktopSessionProxy( |
| 104 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 105 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, |
| 105 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 106 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 106 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 107 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 107 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 108 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 108 base::WeakPtr<ClientSessionControl> client_session_control, | 109 base::WeakPtr<ClientSessionControl> client_session_control, |
| 109 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 110 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, |
| 110 bool virtual_terminal) | 111 bool virtual_terminal, |
| 112 bool multi_touch_enabled) |
| 111 : audio_capture_task_runner_(audio_capture_task_runner), | 113 : audio_capture_task_runner_(audio_capture_task_runner), |
| 112 caller_task_runner_(caller_task_runner), | 114 caller_task_runner_(caller_task_runner), |
| 113 io_task_runner_(io_task_runner), | 115 io_task_runner_(io_task_runner), |
| 114 video_capture_task_runner_(video_capture_task_runner), | 116 video_capture_task_runner_(video_capture_task_runner), |
| 115 client_session_control_(client_session_control), | 117 client_session_control_(client_session_control), |
| 116 desktop_session_connector_(desktop_session_connector), | 118 desktop_session_connector_(desktop_session_connector), |
| 117 pending_capture_frame_requests_(0), | 119 pending_capture_frame_requests_(0), |
| 118 is_desktop_session_connected_(false), | 120 is_desktop_session_connected_(false), |
| 119 virtual_terminal_(virtual_terminal) { | 121 virtual_terminal_(virtual_terminal), |
| 122 multi_touch_enabled_(multi_touch_enabled) { |
| 120 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 123 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 121 } | 124 } |
| 122 | 125 |
| 123 scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() { | 126 scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() { |
| 124 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 127 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 125 | 128 |
| 126 return make_scoped_ptr(new IpcAudioCapturer(this)); | 129 return make_scoped_ptr(new IpcAudioCapturer(this)); |
| 127 } | 130 } |
| 128 | 131 |
| 129 scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() { | 132 scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 147 scoped_ptr<webrtc::MouseCursorMonitor> | 150 scoped_ptr<webrtc::MouseCursorMonitor> |
| 148 DesktopSessionProxy::CreateMouseCursorMonitor() { | 151 DesktopSessionProxy::CreateMouseCursorMonitor() { |
| 149 return make_scoped_ptr(new IpcMouseCursorMonitor(this)); | 152 return make_scoped_ptr(new IpcMouseCursorMonitor(this)); |
| 150 } | 153 } |
| 151 | 154 |
| 152 std::string DesktopSessionProxy::GetCapabilities() const { | 155 std::string DesktopSessionProxy::GetCapabilities() const { |
| 153 std::string result = kRateLimitResizeRequests; | 156 std::string result = kRateLimitResizeRequests; |
| 154 // Ask the client to send its resolution unconditionally. | 157 // Ask the client to send its resolution unconditionally. |
| 155 if (virtual_terminal_) | 158 if (virtual_terminal_) |
| 156 result = result + " " + kSendInitialResolution; | 159 result = result + " " + kSendInitialResolution; |
| 160 |
| 161 if (multi_touch_enabled_) |
| 162 result = result + " " + kMultiTouchCapability; |
| 163 |
| 157 return result; | 164 return result; |
| 158 } | 165 } |
| 159 | 166 |
| 160 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { | 167 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { |
| 161 // Delay creation of the desktop session until the client screen resolution is | 168 // Delay creation of the desktop session until the client screen resolution is |
| 162 // received if the desktop session requires the initial screen resolution | 169 // received if the desktop session requires the initial screen resolution |
| 163 // (when |virtual_terminal_| is true) and the client is expected to | 170 // (when |virtual_terminal_| is true) and the client is expected to |
| 164 // sent its screen resolution (the 'sendInitialResolution' capability is | 171 // sent its screen resolution (the 'sendInitialResolution' capability is |
| 165 // supported). | 172 // supported). |
| 166 if (virtual_terminal_ && | 173 if (virtual_terminal_ && |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 578 } |
| 572 | 579 |
| 573 // static | 580 // static |
| 574 void DesktopSessionProxyTraits::Destruct( | 581 void DesktopSessionProxyTraits::Destruct( |
| 575 const DesktopSessionProxy* desktop_session_proxy) { | 582 const DesktopSessionProxy* desktop_session_proxy) { |
| 576 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 583 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 577 desktop_session_proxy); | 584 desktop_session_proxy); |
| 578 } | 585 } |
| 579 | 586 |
| 580 } // namespace remoting | 587 } // namespace remoting |
| OLD | NEW |