| 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/me2me_desktop_environment.h" | 5 #include "remoting/host/me2me_desktop_environment.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "remoting/base/logging.h" | 9 #include "remoting/base/logging.h" |
| 10 #include "remoting/host/client_session_control.h" | 10 #include "remoting/host/client_session_control.h" |
| 11 #include "remoting/host/curtain_mode.h" | 11 #include "remoting/host/curtain_mode.h" |
| 12 #include "remoting/host/desktop_resizer.h" | 12 #include "remoting/host/desktop_resizer.h" |
| 13 #include "remoting/host/gnubby_auth_handler.h" | 13 #include "remoting/host/gnubby_auth_handler.h" |
| 14 #include "remoting/host/host_window.h" | 14 #include "remoting/host/host_window.h" |
| 15 #include "remoting/host/host_window.h" | 15 #include "remoting/host/host_window.h" |
| 16 #include "remoting/host/host_window_proxy.h" | 16 #include "remoting/host/host_window_proxy.h" |
| 17 #include "remoting/host/local_input_monitor.h" | 17 #include "remoting/host/local_input_monitor.h" |
| 18 #include "remoting/host/resizing_host_observer.h" | 18 #include "remoting/host/resizing_host_observer.h" |
| 19 #include "remoting/host/screen_controls.h" | 19 #include "remoting/host/screen_controls.h" |
| 20 #include "remoting/protocol/capability_names.h" |
| 20 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 21 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 21 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 22 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 22 | 23 |
| 23 #if defined(OS_POSIX) | 24 #if defined(OS_POSIX) |
| 24 #include <sys/types.h> | 25 #include <sys/types.h> |
| 25 #include <unistd.h> | 26 #include <unistd.h> |
| 26 #endif // defined(OS_POSIX) | 27 #endif // defined(OS_POSIX) |
| 27 | 28 |
| 28 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests"; | |
| 29 | |
| 30 namespace remoting { | 29 namespace remoting { |
| 31 | 30 |
| 32 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { | 31 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { |
| 33 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 32 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 34 } | 33 } |
| 35 | 34 |
| 36 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() { | 35 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() { |
| 37 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 36 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 38 | 37 |
| 39 return make_scoped_ptr(new ResizingHostObserver(DesktopResizer::Create())); | 38 return make_scoped_ptr(new ResizingHostObserver(DesktopResizer::Create())); |
| 40 } | 39 } |
| 41 | 40 |
| 42 std::string Me2MeDesktopEnvironment::GetCapabilities() const { | 41 std::string Me2MeDesktopEnvironment::GetCapabilities() const { |
| 43 return kRateLimitResizeRequests; | 42 std::string capabilities = BasicDesktopEnvironment::GetCapabilities(); |
| 43 if (!capabilities.empty()) |
| 44 capabilities.append(" "); |
| 45 capabilities.append(protocol::kRateLimitResizeRequests); |
| 46 |
| 47 return capabilities; |
| 44 } | 48 } |
| 45 | 49 |
| 46 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( | 50 Me2MeDesktopEnvironment::Me2MeDesktopEnvironment( |
| 47 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 51 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 48 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 52 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 49 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 53 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 54 bool supports_touch_events) |
| 50 : BasicDesktopEnvironment(caller_task_runner, | 55 : BasicDesktopEnvironment(caller_task_runner, |
| 51 input_task_runner, | 56 input_task_runner, |
| 52 ui_task_runner), | 57 ui_task_runner, |
| 58 supports_touch_events), |
| 53 gnubby_auth_enabled_(false) { | 59 gnubby_auth_enabled_(false) { |
| 54 DCHECK(caller_task_runner->BelongsToCurrentThread()); | 60 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
| 55 desktop_capture_options()->set_use_update_notifications(true); | 61 desktop_capture_options()->set_use_update_notifications(true); |
| 56 } | 62 } |
| 57 | 63 |
| 58 scoped_ptr<GnubbyAuthHandler> Me2MeDesktopEnvironment::CreateGnubbyAuthHandler( | 64 scoped_ptr<GnubbyAuthHandler> Me2MeDesktopEnvironment::CreateGnubbyAuthHandler( |
| 59 protocol::ClientStub* client_stub) { | 65 protocol::ClientStub* client_stub) { |
| 60 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 66 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 61 | 67 |
| 62 if (gnubby_auth_enabled_) | 68 if (gnubby_auth_enabled_) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { | 142 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { |
| 137 } | 143 } |
| 138 | 144 |
| 139 scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( | 145 scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( |
| 140 base::WeakPtr<ClientSessionControl> client_session_control) { | 146 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 141 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 147 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 142 | 148 |
| 143 scoped_ptr<Me2MeDesktopEnvironment> desktop_environment( | 149 scoped_ptr<Me2MeDesktopEnvironment> desktop_environment( |
| 144 new Me2MeDesktopEnvironment(caller_task_runner(), | 150 new Me2MeDesktopEnvironment(caller_task_runner(), |
| 145 input_task_runner(), | 151 input_task_runner(), |
| 146 ui_task_runner())); | 152 ui_task_runner(), |
| 153 supports_touch_events())); |
| 147 if (!desktop_environment->InitializeSecurity(client_session_control, | 154 if (!desktop_environment->InitializeSecurity(client_session_control, |
| 148 curtain_enabled_)) { | 155 curtain_enabled_)) { |
| 149 return nullptr; | 156 return nullptr; |
| 150 } | 157 } |
| 151 desktop_environment->SetEnableGnubbyAuth(gnubby_auth_enabled_); | 158 desktop_environment->SetEnableGnubbyAuth(gnubby_auth_enabled_); |
| 152 | 159 |
| 153 return desktop_environment.Pass(); | 160 return desktop_environment.Pass(); |
| 154 } | 161 } |
| 155 | 162 |
| 156 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) { | 163 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) { |
| 157 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 164 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 158 | 165 |
| 159 curtain_enabled_ = enable; | 166 curtain_enabled_ = enable; |
| 160 } | 167 } |
| 161 | 168 |
| 162 void Me2MeDesktopEnvironmentFactory::SetEnableGnubbyAuth( | 169 void Me2MeDesktopEnvironmentFactory::SetEnableGnubbyAuth( |
| 163 bool gnubby_auth_enabled) { | 170 bool gnubby_auth_enabled) { |
| 164 gnubby_auth_enabled_ = gnubby_auth_enabled; | 171 gnubby_auth_enabled_ = gnubby_auth_enabled; |
| 165 } | 172 } |
| 166 | 173 |
| 167 } // namespace remoting | 174 } // namespace remoting |
| OLD | NEW |