| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/single_window_desktop_environment.h" | 5 #include "remoting/host/single_window_desktop_environment.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 10 #include "remoting/host/single_window_input_injector.h" | 12 #include "remoting/host/single_window_input_injector.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 14 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
| 13 | 15 |
| 14 namespace remoting { | 16 namespace remoting { |
| 15 | 17 |
| 16 // Enables capturing and streaming of windows. | 18 // Enables capturing and streaming of windows. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 32 webrtc::WindowId window_id, | 34 webrtc::WindowId window_id, |
| 33 bool supports_touch_events); | 35 bool supports_touch_events); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 webrtc::WindowId window_id_; | 38 webrtc::WindowId window_id_; |
| 37 | 39 |
| 38 DISALLOW_COPY_AND_ASSIGN(SingleWindowDesktopEnvironment); | 40 DISALLOW_COPY_AND_ASSIGN(SingleWindowDesktopEnvironment); |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() { | 43 SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() {} |
| 42 } | |
| 43 | 44 |
| 44 scoped_ptr<webrtc::DesktopCapturer> | 45 scoped_ptr<webrtc::DesktopCapturer> |
| 45 SingleWindowDesktopEnvironment::CreateVideoCapturer() { | 46 SingleWindowDesktopEnvironment::CreateVideoCapturer() { |
| 46 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 47 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 47 | 48 |
| 48 webrtc::DesktopCaptureOptions options = | 49 webrtc::DesktopCaptureOptions options = |
| 49 webrtc::DesktopCaptureOptions::CreateDefault(); | 50 webrtc::DesktopCaptureOptions::CreateDefault(); |
| 50 options.set_use_update_notifications(true); | 51 options.set_use_update_notifications(true); |
| 51 | 52 |
| 52 scoped_ptr<webrtc::WindowCapturer>window_capturer( | 53 scoped_ptr<webrtc::WindowCapturer> window_capturer( |
| 53 webrtc::WindowCapturer::Create(options)); | 54 webrtc::WindowCapturer::Create(options)); |
| 54 window_capturer->SelectWindow(window_id_); | 55 window_capturer->SelectWindow(window_id_); |
| 55 | 56 |
| 56 return window_capturer.Pass(); | 57 return std::move(window_capturer); |
| 57 } | 58 } |
| 58 | 59 |
| 59 scoped_ptr<InputInjector> | 60 scoped_ptr<InputInjector> |
| 60 SingleWindowDesktopEnvironment::CreateInputInjector() { | 61 SingleWindowDesktopEnvironment::CreateInputInjector() { |
| 61 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 62 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 62 | 63 |
| 63 scoped_ptr<InputInjector> input_injector( | 64 scoped_ptr<InputInjector> input_injector( |
| 64 InputInjector::Create(input_task_runner(), | 65 InputInjector::Create(input_task_runner(), |
| 65 ui_task_runner())); | 66 ui_task_runner())); |
| 66 return SingleWindowInputInjector::CreateForWindow( | 67 return SingleWindowInputInjector::CreateForWindow( |
| 67 window_id_, input_injector.Pass()).Pass(); | 68 window_id_, std::move(input_injector)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment( | 71 SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment( |
| 71 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 72 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 73 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 74 webrtc::WindowId window_id, | 75 webrtc::WindowId window_id, |
| 75 bool supports_touch_events) | 76 bool supports_touch_events) |
| 76 : BasicDesktopEnvironment(caller_task_runner, | 77 : BasicDesktopEnvironment(caller_task_runner, |
| 77 input_task_runner, | 78 input_task_runner, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 98 scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create( | 99 scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create( |
| 99 base::WeakPtr<ClientSessionControl> client_session_control) { | 100 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 100 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 101 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 101 | 102 |
| 102 scoped_ptr<SingleWindowDesktopEnvironment> desktop_environment( | 103 scoped_ptr<SingleWindowDesktopEnvironment> desktop_environment( |
| 103 new SingleWindowDesktopEnvironment(caller_task_runner(), | 104 new SingleWindowDesktopEnvironment(caller_task_runner(), |
| 104 input_task_runner(), | 105 input_task_runner(), |
| 105 ui_task_runner(), | 106 ui_task_runner(), |
| 106 window_id_, | 107 window_id_, |
| 107 supports_touch_events())); | 108 supports_touch_events())); |
| 108 return desktop_environment.Pass(); | 109 return std::move(desktop_environment); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace remoting | 112 } // namespace remoting |
| OLD | NEW |