| 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_DESKTOP_ENVIRONMENT_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
| 6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 6 #define REMOTING_HOST_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/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 | 14 |
| 15 namespace base { |
| 16 class SingleThreadTaskRunner; |
| 17 } // namespace base |
| 18 |
| 14 namespace remoting { | 19 namespace remoting { |
| 15 | 20 |
| 16 class AudioCapturer; | 21 class AudioCapturer; |
| 17 class EventExecutor; | 22 class EventExecutor; |
| 18 class VideoFrameCapturer; | 23 class VideoFrameCapturer; |
| 19 | 24 |
| 20 namespace protocol { | 25 // Provides factory methods for creation of audio/video capturers and event |
| 21 class ClipboardStub; | 26 // executor for a given desktop environment. |
| 22 } | |
| 23 | |
| 24 class DesktopEnvironment { | 27 class DesktopEnvironment { |
| 25 public: | 28 public: |
| 26 DesktopEnvironment(scoped_ptr<AudioCapturer> audio_capturer, | 29 virtual ~DesktopEnvironment() {} |
| 27 scoped_ptr<EventExecutor> event_executor, | |
| 28 scoped_ptr<VideoFrameCapturer> video_capturer); | |
| 29 virtual ~DesktopEnvironment(); | |
| 30 | 30 |
| 31 AudioCapturer* audio_capturer() const { return audio_capturer_.get(); } | 31 // Factory methods used to create audio/video capturers and event executor for |
| 32 EventExecutor* event_executor() const { return event_executor_.get(); } | 32 // a particular desktop environment. |
| 33 VideoFrameCapturer* video_capturer() const { return video_capturer_.get(); } | 33 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( |
| 34 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) = 0; |
| 35 virtual scoped_ptr<EventExecutor> CreateEventExecutor( |
| 36 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) = 0; |
| 38 virtual scoped_ptr<VideoFrameCapturer> CreateVideoCapturer( |
| 39 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) = 0; |
| 41 }; |
| 34 | 42 |
| 35 // Starts the desktop environment passing |client_jid| of the attached | 43 // Used to create |DesktopEnvironment| instances. |
| 36 // authenticated session. Registers |client_clipboard| to receive | 44 class DesktopEnvironmentFactory { |
| 37 // notifications about local clipboard changes. |disconnect_callback| can be | 45 public: |
| 38 // invoked by the DesktopEnvironment to request the client session to be | 46 virtual ~DesktopEnvironmentFactory() {} |
| 39 // disconnected. |disconnect_callback| is invoked on the same thread Start() | 47 |
| 40 // has been called on. | 48 // Creates an instance of |DesktopEnvironment|. |disconnect_callback| may be |
| 41 virtual void Start( | 49 // used by the DesktopEnvironment to disconnect the client session. |
| 42 scoped_ptr<protocol::ClipboardStub> client_clipboard, | 50 virtual scoped_ptr<DesktopEnvironment> Create( |
| 43 const std::string& client_jid, | 51 const std::string& client_jid, |
| 44 const base::Closure& disconnect_callback); | 52 const base::Closure& disconnect_callback) = 0; |
| 45 | 53 |
| 46 private: | 54 // Returns |true| if created |DesktopEnvironment| instances support audio |
| 47 // Used to capture audio to deliver to clients. | 55 // capture. |
| 48 scoped_ptr<AudioCapturer> audio_capturer_; | 56 virtual bool SupportsAudioCapture() const = 0; |
| 49 | |
| 50 // Executes input and clipboard events received from the client. | |
| 51 scoped_ptr<EventExecutor> event_executor_; | |
| 52 | |
| 53 // Used to capture video to deliver to clients. | |
| 54 scoped_ptr<VideoFrameCapturer> video_capturer_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); | |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace remoting | 59 } // namespace remoting |
| 60 | 60 |
| 61 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 61 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
| OLD | NEW |