| 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 <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/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "remoting/base/logging.h" | 13 #include "remoting/base/logging.h" |
| 13 #include "remoting/host/client_session_control.h" | 14 #include "remoting/host/client_session_control.h" |
| 14 #include "remoting/host/curtain_mode.h" | 15 #include "remoting/host/curtain_mode.h" |
| 15 #include "remoting/host/desktop_resizer.h" | 16 #include "remoting/host/desktop_resizer.h" |
| 16 #include "remoting/host/host_window.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_proxy.h" | 19 #include "remoting/host/host_window_proxy.h" |
| 19 #include "remoting/host/local_input_monitor.h" | 20 #include "remoting/host/local_input_monitor.h" |
| 20 #include "remoting/host/resizing_host_observer.h" | 21 #include "remoting/host/resizing_host_observer.h" |
| 21 #include "remoting/host/screen_controls.h" | 22 #include "remoting/host/screen_controls.h" |
| 22 #include "remoting/protocol/capability_names.h" | 23 #include "remoting/protocol/capability_names.h" |
| 23 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 24 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 24 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 25 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 25 | 26 |
| 26 #if defined(OS_POSIX) | 27 #if defined(OS_POSIX) |
| 27 #include <sys/types.h> | 28 #include <sys/types.h> |
| 28 #include <unistd.h> | 29 #include <unistd.h> |
| 29 #endif // defined(OS_POSIX) | 30 #endif // defined(OS_POSIX) |
| 30 | 31 |
| 31 namespace remoting { | 32 namespace remoting { |
| 32 | 33 |
| 33 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { | 34 Me2MeDesktopEnvironment::~Me2MeDesktopEnvironment() { |
| 34 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 35 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 35 } | 36 } |
| 36 | 37 |
| 37 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() { | 38 std::unique_ptr<ScreenControls> |
| 39 Me2MeDesktopEnvironment::CreateScreenControls() { |
| 38 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 40 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 39 | 41 |
| 40 return make_scoped_ptr(new ResizingHostObserver(DesktopResizer::Create())); | 42 return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create())); |
| 41 } | 43 } |
| 42 | 44 |
| 43 std::string Me2MeDesktopEnvironment::GetCapabilities() const { | 45 std::string Me2MeDesktopEnvironment::GetCapabilities() const { |
| 44 std::string capabilities = BasicDesktopEnvironment::GetCapabilities(); | 46 std::string capabilities = BasicDesktopEnvironment::GetCapabilities(); |
| 45 if (!capabilities.empty()) | 47 if (!capabilities.empty()) |
| 46 capabilities.append(" "); | 48 capabilities.append(" "); |
| 47 capabilities.append(protocol::kRateLimitResizeRequests); | 49 capabilities.append(protocol::kRateLimitResizeRequests); |
| 48 | 50 |
| 49 return capabilities; | 51 return capabilities; |
| 50 } | 52 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 127 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 126 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 128 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
| 127 : BasicDesktopEnvironmentFactory(caller_task_runner, | 129 : BasicDesktopEnvironmentFactory(caller_task_runner, |
| 128 video_capture_task_runner, | 130 video_capture_task_runner, |
| 129 input_task_runner, | 131 input_task_runner, |
| 130 ui_task_runner) {} | 132 ui_task_runner) {} |
| 131 | 133 |
| 132 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { | 134 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() { |
| 133 } | 135 } |
| 134 | 136 |
| 135 scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( | 137 std::unique_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create( |
| 136 base::WeakPtr<ClientSessionControl> client_session_control) { | 138 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 137 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 139 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 138 | 140 |
| 139 scoped_ptr<Me2MeDesktopEnvironment> desktop_environment( | 141 std::unique_ptr<Me2MeDesktopEnvironment> desktop_environment( |
| 140 new Me2MeDesktopEnvironment( | 142 new Me2MeDesktopEnvironment( |
| 141 caller_task_runner(), video_capture_task_runner(), | 143 caller_task_runner(), video_capture_task_runner(), |
| 142 input_task_runner(), ui_task_runner(), supports_touch_events())); | 144 input_task_runner(), ui_task_runner(), supports_touch_events())); |
| 143 if (!desktop_environment->InitializeSecurity(client_session_control, | 145 if (!desktop_environment->InitializeSecurity(client_session_control, |
| 144 curtain_enabled_)) { | 146 curtain_enabled_)) { |
| 145 return nullptr; | 147 return nullptr; |
| 146 } | 148 } |
| 147 | 149 |
| 148 return std::move(desktop_environment); | 150 return std::move(desktop_environment); |
| 149 } | 151 } |
| 150 | 152 |
| 151 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) { | 153 void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) { |
| 152 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 154 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 153 | 155 |
| 154 curtain_enabled_ = enable; | 156 curtain_enabled_ = enable; |
| 155 } | 157 } |
| 156 | 158 |
| 157 } // namespace remoting | 159 } // namespace remoting |
| OLD | NEW |