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 18 matching lines...) Expand all Loading... |
29 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" | 29 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" |
30 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" | 30 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 #include "base/win/scoped_handle.h" | 33 #include "base/win/scoped_handle.h" |
34 #endif // defined(OS_WIN) | 34 #endif // defined(OS_WIN) |
35 | 35 |
36 const bool kReadOnly = true; | 36 const bool kReadOnly = true; |
37 const char kSendInitialResolution[] = "sendInitialResolution"; | 37 const char kSendInitialResolution[] = "sendInitialResolution"; |
38 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests"; | 38 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests"; |
| 39 const char kRawTouchEventsCapability[] = "rawTouchEvents"; |
39 | 40 |
40 namespace remoting { | 41 namespace remoting { |
41 | 42 |
42 class DesktopSessionProxy::IpcSharedBufferCore | 43 class DesktopSessionProxy::IpcSharedBufferCore |
43 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { | 44 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { |
44 public: | 45 public: |
45 IpcSharedBufferCore(int id, | 46 IpcSharedBufferCore(int id, |
46 base::SharedMemoryHandle handle, | 47 base::SharedMemoryHandle handle, |
47 base::ProcessHandle process, | 48 base::ProcessHandle process, |
48 size_t size) | 49 size_t size) |
(...skipping 51 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 supports_raw_touch_events) |
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 supports_raw_touch_events_(supports_raw_touch_events) { |
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 (supports_raw_touch_events_) |
| 162 result = result + " " + kRawTouchEventsCapability; |
| 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 |