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/basic_desktop_environment.h" | 5 #include "remoting/host/basic_desktop_environment.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/video/capture/screen/screen_capturer.h" | 8 #include "media/video/capture/screen/screen_capturer.h" |
9 #include "remoting/host/audio_capturer.h" | 9 #include "remoting/host/audio_capturer.h" |
| 10 #include "remoting/host/desktop_resizer.h" |
10 #include "remoting/host/event_executor.h" | 11 #include "remoting/host/event_executor.h" |
| 12 #include "remoting/host/resizing_host_observer.h" |
11 | 13 |
12 namespace remoting { | 14 namespace remoting { |
13 | 15 |
14 BasicDesktopEnvironment::BasicDesktopEnvironment(bool use_x_damage) | 16 BasicDesktopEnvironment::BasicDesktopEnvironment(bool use_x_damage) |
15 : use_x_damage_(use_x_damage) { | 17 : use_x_damage_(use_x_damage) { |
16 } | 18 } |
17 | 19 |
18 BasicDesktopEnvironment::~BasicDesktopEnvironment() { | 20 BasicDesktopEnvironment::~BasicDesktopEnvironment() { |
19 DCHECK(CalledOnValidThread()); | 21 DCHECK(CalledOnValidThread()); |
20 } | 22 } |
21 | 23 |
22 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer( | 24 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer( |
23 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) { | 25 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) { |
24 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
25 | 27 |
26 return AudioCapturer::Create(); | 28 return AudioCapturer::Create(); |
27 } | 29 } |
28 | 30 |
29 scoped_ptr<EventExecutor> BasicDesktopEnvironment::CreateEventExecutor( | 31 scoped_ptr<EventExecutor> BasicDesktopEnvironment::CreateEventExecutor( |
30 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
32 DCHECK(CalledOnValidThread()); | 34 DCHECK(CalledOnValidThread()); |
33 | 35 |
34 return EventExecutor::Create(input_task_runner, ui_task_runner); | 36 return EventExecutor::Create(input_task_runner, ui_task_runner); |
35 } | 37 } |
36 | 38 |
| 39 scoped_ptr<SessionController> |
| 40 BasicDesktopEnvironment::CreateSessionController() { |
| 41 DCHECK(CalledOnValidThread()); |
| 42 |
| 43 scoped_ptr<SessionController> session_controller( |
| 44 new ResizingHostObserver(DesktopResizer::Create())); |
| 45 return session_controller.Pass(); |
| 46 } |
| 47 |
37 scoped_ptr<media::ScreenCapturer> BasicDesktopEnvironment::CreateVideoCapturer( | 48 scoped_ptr<media::ScreenCapturer> BasicDesktopEnvironment::CreateVideoCapturer( |
38 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 49 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
39 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) { | 50 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) { |
40 DCHECK(CalledOnValidThread()); | 51 DCHECK(CalledOnValidThread()); |
41 | 52 |
42 #if defined(OS_LINUX) | 53 #if defined(OS_LINUX) |
43 return media::ScreenCapturer::CreateWithXDamage(use_x_damage_); | 54 return media::ScreenCapturer::CreateWithXDamage(use_x_damage_); |
44 #else // !defined(OS_LINUX) | 55 #else // !defined(OS_LINUX) |
45 return media::ScreenCapturer::Create(); | 56 return media::ScreenCapturer::Create(); |
46 #endif // !defined(OS_LINUX) | 57 #endif // !defined(OS_LINUX) |
(...skipping 12 matching lines...) Expand all Loading... |
59 const base::Closure& disconnect_callback) { | 70 const base::Closure& disconnect_callback) { |
60 return scoped_ptr<DesktopEnvironment>( | 71 return scoped_ptr<DesktopEnvironment>( |
61 new BasicDesktopEnvironment(use_x_damage_)); | 72 new BasicDesktopEnvironment(use_x_damage_)); |
62 } | 73 } |
63 | 74 |
64 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { | 75 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { |
65 return AudioCapturer::IsSupported(); | 76 return AudioCapturer::IsSupported(); |
66 } | 77 } |
67 | 78 |
68 } // namespace remoting | 79 } // namespace remoting |
OLD | NEW |