Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: remoting/host/desktop_session_proxy.cc

Issue 1033913003: Touch Events capability negotiation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change setter to public and add license header Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/desktop_session_proxy.h ('k') | remoting/host/input_injector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/proto/audio.pb.h" 24 #include "remoting/proto/audio.pb.h"
25 #include "remoting/proto/control.pb.h" 25 #include "remoting/proto/control.pb.h"
26 #include "remoting/proto/event.pb.h" 26 #include "remoting/proto/event.pb.h"
27 #include "remoting/protocol/capability_names.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"
34 #endif // defined(OS_WIN) 35 #endif // defined(OS_WIN)
35 36
36 const bool kReadOnly = true; 37 const bool kReadOnly = true;
37 const char kSendInitialResolution[] = "sendInitialResolution";
38 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests";
39 38
40 namespace remoting { 39 namespace remoting {
41 40
42 class DesktopSessionProxy::IpcSharedBufferCore 41 class DesktopSessionProxy::IpcSharedBufferCore
43 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { 42 : public base::RefCountedThreadSafe<IpcSharedBufferCore> {
44 public: 43 public:
45 IpcSharedBufferCore(int id, 44 IpcSharedBufferCore(int id,
46 base::SharedMemoryHandle handle, 45 base::SharedMemoryHandle handle,
47 base::ProcessHandle process, 46 base::ProcessHandle process,
48 size_t size) 47 size_t size)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); 101 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer);
103 }; 102 };
104 103
105 DesktopSessionProxy::DesktopSessionProxy( 104 DesktopSessionProxy::DesktopSessionProxy(
106 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, 105 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner,
107 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 106 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
108 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 107 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
109 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 108 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
110 base::WeakPtr<ClientSessionControl> client_session_control, 109 base::WeakPtr<ClientSessionControl> client_session_control,
111 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, 110 base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
112 bool virtual_terminal) 111 bool virtual_terminal,
112 bool supports_touch_events)
113 : audio_capture_task_runner_(audio_capture_task_runner), 113 : audio_capture_task_runner_(audio_capture_task_runner),
114 caller_task_runner_(caller_task_runner), 114 caller_task_runner_(caller_task_runner),
115 io_task_runner_(io_task_runner), 115 io_task_runner_(io_task_runner),
116 video_capture_task_runner_(video_capture_task_runner), 116 video_capture_task_runner_(video_capture_task_runner),
117 client_session_control_(client_session_control), 117 client_session_control_(client_session_control),
118 desktop_session_connector_(desktop_session_connector), 118 desktop_session_connector_(desktop_session_connector),
119 pending_capture_frame_requests_(0), 119 pending_capture_frame_requests_(0),
120 is_desktop_session_connected_(false), 120 is_desktop_session_connected_(false),
121 virtual_terminal_(virtual_terminal) { 121 virtual_terminal_(virtual_terminal),
122 supports_touch_events_(supports_touch_events) {
122 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 123 DCHECK(caller_task_runner_->BelongsToCurrentThread());
123 } 124 }
124 125
125 scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() { 126 scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() {
126 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 127 DCHECK(caller_task_runner_->BelongsToCurrentThread());
127 128
128 return make_scoped_ptr(new IpcAudioCapturer(this)); 129 return make_scoped_ptr(new IpcAudioCapturer(this));
129 } 130 }
130 131
131 scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() { 132 scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() {
(...skipping 13 matching lines...) Expand all
145 146
146 return make_scoped_ptr(new IpcVideoFrameCapturer(this)); 147 return make_scoped_ptr(new IpcVideoFrameCapturer(this));
147 } 148 }
148 149
149 scoped_ptr<webrtc::MouseCursorMonitor> 150 scoped_ptr<webrtc::MouseCursorMonitor>
150 DesktopSessionProxy::CreateMouseCursorMonitor() { 151 DesktopSessionProxy::CreateMouseCursorMonitor() {
151 return make_scoped_ptr(new IpcMouseCursorMonitor(this)); 152 return make_scoped_ptr(new IpcMouseCursorMonitor(this));
152 } 153 }
153 154
154 std::string DesktopSessionProxy::GetCapabilities() const { 155 std::string DesktopSessionProxy::GetCapabilities() const {
155 std::string result = kRateLimitResizeRequests; 156 std::string result = protocol::kRateLimitResizeRequests;
156 // Ask the client to send its resolution unconditionally. 157 // Ask the client to send its resolution unconditionally.
157 if (virtual_terminal_) 158 if (virtual_terminal_)
158 result = result + " " + kSendInitialResolution; 159 result = result + " " + protocol::kSendInitialResolution;
160
161 if (supports_touch_events_)
162 result = result + " " + protocol::kTouchEventsCapability;
163
159 return result; 164 return result;
160 } 165 }
161 166
162 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { 167 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) {
163 // 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
164 // received if the desktop session requires the initial screen resolution 169 // received if the desktop session requires the initial screen resolution
165 // (when |virtual_terminal_| is true) and the client is expected to 170 // (when |virtual_terminal_| is true) and the client is expected to
166 // sent its screen resolution (the 'sendInitialResolution' capability is 171 // sent its screen resolution (the 'sendInitialResolution' capability is
167 // supported). 172 // supported).
168 if (virtual_terminal_ && 173 if (virtual_terminal_ &&
169 HasCapability(capabilities, kSendInitialResolution)) { 174 HasCapability(capabilities, protocol::kSendInitialResolution)) {
170 VLOG(1) << "Waiting for the client screen resolution."; 175 VLOG(1) << "Waiting for the client screen resolution.";
171 return; 176 return;
172 } 177 }
173 178
174 // Connect to the desktop session. 179 // Connect to the desktop session.
175 if (!is_desktop_session_connected_) { 180 if (!is_desktop_session_connected_) {
176 is_desktop_session_connected_ = true; 181 is_desktop_session_connected_ = true;
177 if (desktop_session_connector_.get()) { 182 if (desktop_session_connector_.get()) {
178 desktop_session_connector_->ConnectTerminal( 183 desktop_session_connector_->ConnectTerminal(
179 this, screen_resolution_, virtual_terminal_); 184 this, screen_resolution_, virtual_terminal_);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 579 }
575 580
576 // static 581 // static
577 void DesktopSessionProxyTraits::Destruct( 582 void DesktopSessionProxyTraits::Destruct(
578 const DesktopSessionProxy* desktop_session_proxy) { 583 const DesktopSessionProxy* desktop_session_proxy) {
579 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, 584 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE,
580 desktop_session_proxy); 585 desktop_session_proxy);
581 } 586 }
582 587
583 } // namespace remoting 588 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_proxy.h ('k') | remoting/host/input_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698