Chromium Code Reviews| 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 | |
| 16 namespace remoting { | 22 namespace remoting { |
| 17 | 23 |
| 18 // Used to create audio/video capturers and event executor that work with | 24 // Used to create audio/video capturers and event executor that work with |
| 19 // the local console. | 25 // the local console. |
| 20 class BasicDesktopEnvironment : public DesktopEnvironment { | 26 class BasicDesktopEnvironment : public DesktopEnvironment { |
| 21 public: | 27 public: |
| 22 virtual ~BasicDesktopEnvironment(); | 28 virtual ~BasicDesktopEnvironment(); |
| 23 | 29 |
| 24 // DesktopEnvironment implementation. | 30 // DesktopEnvironment implementation. |
| 25 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; | 31 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
| 26 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; | 32 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; |
| 27 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; | 33 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; |
| 28 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; | 34 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; |
| 35 virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() | |
| 36 OVERRIDE; | |
| 29 virtual std::string GetCapabilities() const OVERRIDE; | 37 virtual std::string GetCapabilities() const OVERRIDE; |
| 30 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 38 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
| 31 | 39 |
| 32 protected: | 40 protected: |
| 33 friend class BasicDesktopEnvironmentFactory; | 41 friend class BasicDesktopEnvironmentFactory; |
| 34 | 42 |
| 35 BasicDesktopEnvironment( | 43 BasicDesktopEnvironment( |
| 36 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 44 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 45 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 38 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 46 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 39 | 47 |
| 40 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | 48 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
| 41 return caller_task_runner_; | 49 return caller_task_runner_; |
| 42 } | 50 } |
| 43 | 51 |
| 44 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | 52 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
| 45 return input_task_runner_; | 53 return input_task_runner_; |
| 46 } | 54 } |
| 47 | 55 |
| 48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | 56 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
| 49 return ui_task_runner_; | 57 return ui_task_runner_; |
| 50 } | 58 } |
| 51 | 59 |
| 60 webrtc::DesktopCaptureOptions* desktop_capture_options() { | |
|
Sergey Ulanov
2014/01/28 20:35:07
nit: I think it's better to return const reference
dcaiafa
2014/01/28 22:36:29
Me2MeDesktopEnvironment must be able to change it
| |
| 61 return desktop_capture_options_.get(); | |
| 62 } | |
| 63 | |
| 52 private: | 64 private: |
| 53 // Task runner on which methods of DesktopEnvironment interface should be | 65 // Task runner on which methods of DesktopEnvironment interface should be |
| 54 // called. | 66 // called. |
| 55 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 56 | 68 |
| 57 // Used to run input-related tasks. | 69 // Used to run input-related tasks. |
| 58 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 70 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 59 | 71 |
| 60 // Used to run UI code. | 72 // Used to run UI code. |
| 61 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 73 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 62 | 74 |
| 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 | |
| 63 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); | 82 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
| 64 }; | 83 }; |
| 65 | 84 |
| 66 // Used to create |BasicDesktopEnvironment| instances. | 85 // Used to create |BasicDesktopEnvironment| instances. |
| 67 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | 86 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
| 68 public: | 87 public: |
| 69 BasicDesktopEnvironmentFactory( | 88 BasicDesktopEnvironmentFactory( |
| 70 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 89 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 71 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 90 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 91 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 98 | 117 |
| 99 // Used to run UI code. | 118 // Used to run UI code. |
| 100 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 119 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 101 | 120 |
| 102 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); | 121 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
| 103 }; | 122 }; |
| 104 | 123 |
| 105 } // namespace remoting | 124 } // namespace remoting |
| 106 | 125 |
| 107 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 126 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
| OLD | NEW |