| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_LOCAL_DESKTOP_ENVIRONMENT_H_ |
| 6 #define REMOTING_HOST_LOCAL_DESKTOP_ENVIRONMENT_H_ |
| 7 |
| 8 #include "remoting/host/desktop_environment.h" |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" |
| 12 #include "base/callback.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 |
| 15 namespace base { |
| 16 class SingleThreadTaskRunner; |
| 17 } // namespace base |
| 18 |
| 19 namespace remoting { |
| 20 |
| 21 class AudioScheduler; |
| 22 class EventExecutor; |
| 23 class VideoScheduler; |
| 24 |
| 25 // Provides a way to capture audio/video and inject input events to the local |
| 26 // console. |
| 27 class LocalDesktopEnvironment : public DesktopEnvironment { |
| 28 public: |
| 29 // Callback prototype that is invoked to create an instance of the event |
| 30 // executor. |
| 31 typedef base::Callback<scoped_ptr<EventExecutor>( |
| 32 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)> |
| 34 CreateEventExecutorCallback; |
| 35 |
| 36 LocalDesktopEnvironment( |
| 37 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 38 const CreateEventExecutorCallback& create_event_executor_callback); |
| 39 virtual ~LocalDesktopEnvironment(); |
| 40 |
| 41 // protocol::ClipboardStub implementation. |
| 42 virtual void InjectClipboardEvent( |
| 43 const protocol::ClipboardEvent& event) OVERRIDE; |
| 44 |
| 45 // protocol::InputStub implementation. |
| 46 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
| 47 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
| 48 |
| 49 // DesktopEnvironment implementation. |
| 50 virtual void StartAudio( |
| 51 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 52 scoped_ptr<AudioEncoder> audio_encoder, |
| 53 protocol::AudioStub* audio_stub) OVERRIDE; |
| 54 virtual void PauseAudio(bool pause) OVERRIDE; |
| 55 virtual void StartInput( |
| 56 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 57 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 58 protocol::ClipboardStub* clipboard_stub) OVERRIDE; |
| 59 virtual void StartVideo( |
| 60 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
| 62 scoped_ptr<VideoEncoder> video_encoder, |
| 63 protocol::CursorShapeStub* cursor_shape_stub, |
| 64 protocol::VideoStub* video_stub) OVERRIDE; |
| 65 virtual SkISize GetScreenSize() const OVERRIDE; |
| 66 virtual void PauseVideo(bool pause) OVERRIDE; |
| 67 virtual void UpdateSequenceNumber(int64 sequence_number) OVERRIDE; |
| 68 |
| 69 private: |
| 70 // Task runner on which public methods of this class should be called. |
| 71 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 72 |
| 73 // Schedulers for audio and video capture. |
| 74 scoped_refptr<AudioScheduler> audio_scheduler_; |
| 75 scoped_refptr<VideoScheduler> video_scheduler_; |
| 76 |
| 77 // Factory for weak pointers to the client clipboard stub. |
| 78 scoped_ptr<base::WeakPtrFactory<protocol::ClipboardStub> > clipboard_factory_; |
| 79 |
| 80 // Invoked create an instance of the event executor. |
| 81 CreateEventExecutorCallback create_event_executor_callback_; |
| 82 |
| 83 // Executes input and clipboard events received from the client. |
| 84 scoped_ptr<EventExecutor> event_executor_; |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(LocalDesktopEnvironment); |
| 87 }; |
| 88 |
| 89 } // namespace remoting |
| 90 |
| 91 #endif // REMOTING_HOST_LOCAL_DESKTOP_ENVIRONMENT_H_ |
| OLD | NEW |