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