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 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 5 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "remoting/host/desktop_environment.h" | 14 #include "remoting/host/desktop_environment.h" |
15 | 15 |
16 namespace webrtc { | |
17 | |
18 class DesktopCaptureOptions; | |
19 | |
20 } // namespace webrtc | |
21 | |
22 namespace remoting { | 16 namespace remoting { |
23 | 17 |
24 // Used to create audio/video capturers and event executor that work with | 18 // Used to create audio/video capturers and event executor that work with |
25 // the local console. | 19 // the local console. |
26 class BasicDesktopEnvironment : public DesktopEnvironment { | 20 class BasicDesktopEnvironment : public DesktopEnvironment { |
27 public: | 21 public: |
28 virtual ~BasicDesktopEnvironment(); | 22 virtual ~BasicDesktopEnvironment(); |
29 | 23 |
30 // DesktopEnvironment implementation. | 24 // DesktopEnvironment implementation. |
31 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; | 25 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
32 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; | 26 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; |
33 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; | 27 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; |
34 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; | 28 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; |
35 virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() | |
36 OVERRIDE; | |
37 virtual std::string GetCapabilities() const OVERRIDE; | 29 virtual std::string GetCapabilities() const OVERRIDE; |
38 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 30 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
39 | 31 |
40 protected: | 32 protected: |
41 friend class BasicDesktopEnvironmentFactory; | 33 friend class BasicDesktopEnvironmentFactory; |
42 | 34 |
43 BasicDesktopEnvironment( | 35 BasicDesktopEnvironment( |
44 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
45 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 37 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
46 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 38 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
47 | 39 |
48 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | 40 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
49 return caller_task_runner_; | 41 return caller_task_runner_; |
50 } | 42 } |
51 | 43 |
52 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | 44 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
53 return input_task_runner_; | 45 return input_task_runner_; |
54 } | 46 } |
55 | 47 |
56 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | 48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
57 return ui_task_runner_; | 49 return ui_task_runner_; |
58 } | 50 } |
59 | 51 |
60 webrtc::DesktopCaptureOptions* desktop_capture_options() { | |
61 return desktop_capture_options_.get(); | |
62 } | |
63 | |
64 private: | 52 private: |
65 // Task runner on which methods of DesktopEnvironment interface should be | 53 // Task runner on which methods of DesktopEnvironment interface should be |
66 // called. | 54 // called. |
67 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 55 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
68 | 56 |
69 // Used to run input-related tasks. | 57 // Used to run input-related tasks. |
70 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 58 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
71 | 59 |
72 // Used to run UI code. | 60 // Used to run UI code. |
73 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 61 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
74 | 62 |
75 // Options shared between |ScreenCapturer| and |MouseCursorMonitor|. It | |
76 // might contain expensive resources, thus justifying the sharing. | |
77 // Also: it's dynamically allocated to avoid having to bring in | |
78 // desktop_capture_options.h which brings in X11 headers which causes hard to | |
79 // find build errors. | |
80 scoped_ptr<webrtc::DesktopCaptureOptions> desktop_capture_options_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); | 63 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
83 }; | 64 }; |
84 | 65 |
85 // Used to create |BasicDesktopEnvironment| instances. | 66 // Used to create |BasicDesktopEnvironment| instances. |
86 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | 67 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
87 public: | 68 public: |
88 BasicDesktopEnvironmentFactory( | 69 BasicDesktopEnvironmentFactory( |
89 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
90 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
91 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
(...skipping 25 matching lines...) Expand all Loading... |
117 | 98 |
118 // Used to run UI code. | 99 // Used to run UI code. |
119 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 100 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
120 | 101 |
121 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); | 102 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
122 }; | 103 }; |
123 | 104 |
124 } // namespace remoting | 105 } // namespace remoting |
125 | 106 |
126 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 107 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
OLD | NEW |