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

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

Issue 2456563002: Remove supports_touch_events flag from BasicDesktopEnvironment (Closed)
Patch Set: Created 4 years, 1 month 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
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/me2me_desktop_environment.h" 5 #include "remoting/host/me2me_desktop_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "remoting/base/logging.h" 13 #include "remoting/base/logging.h"
14 #include "remoting/host/client_session_control.h" 14 #include "remoting/host/client_session_control.h"
15 #include "remoting/host/curtain_mode.h" 15 #include "remoting/host/curtain_mode.h"
16 #include "remoting/host/desktop_resizer.h" 16 #include "remoting/host/desktop_resizer.h"
17 #include "remoting/host/host_window.h" 17 #include "remoting/host/host_window.h"
18 #include "remoting/host/host_window.h" 18 #include "remoting/host/host_window.h"
19 #include "remoting/host/host_window_proxy.h" 19 #include "remoting/host/host_window_proxy.h"
20 #include "remoting/host/input_injector.h"
20 #include "remoting/host/local_input_monitor.h" 21 #include "remoting/host/local_input_monitor.h"
21 #include "remoting/host/resizing_host_observer.h" 22 #include "remoting/host/resizing_host_observer.h"
22 #include "remoting/host/screen_controls.h" 23 #include "remoting/host/screen_controls.h"
23 #include "remoting/protocol/capability_names.h" 24 #include "remoting/protocol/capability_names.h"
24 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" 25 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
25 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" 26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
26 27
27 #if defined(OS_POSIX) 28 #if defined(OS_POSIX)
28 #include <sys/types.h> 29 #include <sys/types.h>
29 #include <unistd.h> 30 #include <unistd.h>
(...skipping 12 matching lines...) Expand all
42 // We only want to restore the host resolution on disconnect if we are not 43 // We only want to restore the host resolution on disconnect if we are not
43 // curtained so we don't mess up the user's window layout unnecessarily if 44 // curtained so we don't mess up the user's window layout unnecessarily if
44 // they disconnect and reconnect. Both OS X and Windows will restore the 45 // they disconnect and reconnect. Both OS X and Windows will restore the
45 // resolution automatically when the user logs back in on the console, and on 46 // resolution automatically when the user logs back in on the console, and on
46 // Linux the curtain-mode uses a separate session. 47 // Linux the curtain-mode uses a separate session.
47 return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create(), 48 return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create(),
48 curtain_ == nullptr)); 49 curtain_ == nullptr));
49 } 50 }
50 51
51 std::string Me2MeDesktopEnvironment::GetCapabilities() const { 52 std::string Me2MeDesktopEnvironment::GetCapabilities() const {
52 std::string capabilities = BasicDesktopEnvironment::GetCapabilities(); 53 std::string capabilities;
53 if (!capabilities.empty()) 54 capabilities += protocol::kRateLimitResizeRequests;
54 capabilities.append(" "); 55 if (InputInjector::SupportsTouchEvents()) {
55 capabilities.append(protocol::kRateLimitResizeRequests); 56 capabilities += " ";
56 57 capabilities += protocol::kTouchEventsCapability;
Hzj_jie 2016/10/26 18:56:32 string::append?
Sergey Ulanov 2016/10/26 19:32:56 same here. I think += is more readable.
58 }
57 return capabilities; 59 return capabilities;
58 } 60 }
59 61
60 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( 62 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment(
61 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 63 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
62 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 64 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
63 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 65 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
64 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 66 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
65 bool supports_touch_events)
66 : BasicDesktopEnvironment(caller_task_runner, 67 : BasicDesktopEnvironment(caller_task_runner,
67 video_capture_task_runner, 68 video_capture_task_runner,
68 input_task_runner, 69 input_task_runner,
69 ui_task_runner, 70 ui_task_runner) {
70 supports_touch_events) {
71 DCHECK(caller_task_runner->BelongsToCurrentThread()); 71 DCHECK(caller_task_runner->BelongsToCurrentThread());
72 72
73 // X DAMAGE is not enabled by default, since it is broken on many systems - 73 // X DAMAGE is not enabled by default, since it is broken on many systems -
74 // see http://crbug.com/73423. It's safe to enable it here because it works 74 // see http://crbug.com/73423. It's safe to enable it here because it works
75 // properly under Xvfb. 75 // properly under Xvfb.
76 desktop_capture_options()->set_use_update_notifications(true); 76 desktop_capture_options()->set_use_update_notifications(true);
77 } 77 }
78 78
79 bool Me2MeDesktopEnvironment::InitializeSecurity( 79 bool Me2MeDesktopEnvironment::InitializeSecurity(
80 base::WeakPtr<ClientSessionControl> client_session_control, 80 base::WeakPtr<ClientSessionControl> client_session_control,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 ui_task_runner) {} 140 ui_task_runner) {}
141 141
142 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { 142 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() {
143 } 143 }
144 144
145 std::unique_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( 145 std::unique_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create(
146 base::WeakPtr<ClientSessionControl> client_session_control) { 146 base::WeakPtr<ClientSessionControl> client_session_control) {
147 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 147 DCHECK(caller_task_runner()->BelongsToCurrentThread());
148 148
149 std::unique_ptr<Me2MeDesktopEnvironment> desktop_environment( 149 std::unique_ptr<Me2MeDesktopEnvironment> desktop_environment(
150 new Me2MeDesktopEnvironment( 150 new Me2MeDesktopEnvironment(caller_task_runner(),
151 caller_task_runner(), video_capture_task_runner(), 151 video_capture_task_runner(),
152 input_task_runner(), ui_task_runner(), supports_touch_events())); 152 input_task_runner(), ui_task_runner()));
153 if (!desktop_environment->InitializeSecurity(client_session_control, 153 if (!desktop_environment->InitializeSecurity(client_session_control,
154 curtain_enabled_)) { 154 curtain_enabled_)) {
155 return nullptr; 155 return nullptr;
156 } 156 }
157 157
158 return std::move(desktop_environment); 158 return std::move(desktop_environment);
159 } 159 }
160 160
161 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) { 161 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) {
162 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 162 DCHECK(caller_task_runner()->BelongsToCurrentThread());
163 163
164 curtain_enabled_ = enable; 164 curtain_enabled_ = enable;
165 } 165 }
166 166
167 } // namespace remoting 167 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698