| 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 #include "remoting/host/ui_strings.h" | |
| 16 | 15 |
| 17 namespace remoting { | 16 namespace remoting { |
| 18 | 17 |
| 19 // 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 |
| 20 // the local console. | 19 // the local console. |
| 21 class BasicDesktopEnvironment : public DesktopEnvironment { | 20 class BasicDesktopEnvironment : public DesktopEnvironment { |
| 22 public: | 21 public: |
| 23 virtual ~BasicDesktopEnvironment(); | 22 virtual ~BasicDesktopEnvironment(); |
| 24 | 23 |
| 25 // DesktopEnvironment implementation. | 24 // DesktopEnvironment implementation. |
| 26 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; | 25 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
| 27 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; | 26 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; |
| 28 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; | 27 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; |
| 29 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; | 28 virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE; |
| 30 virtual std::string GetCapabilities() const OVERRIDE; | 29 virtual std::string GetCapabilities() const OVERRIDE; |
| 31 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 30 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
| 32 | 31 |
| 33 protected: | 32 protected: |
| 34 friend class BasicDesktopEnvironmentFactory; | 33 friend class BasicDesktopEnvironmentFactory; |
| 35 | 34 |
| 36 // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that | |
| 37 // created |this|. |ui_strings| must outlive this object. | |
| 38 BasicDesktopEnvironment( | 35 BasicDesktopEnvironment( |
| 39 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 37 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 41 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 38 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 42 | 39 |
| 43 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | 40 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
| 44 return caller_task_runner_; | 41 return caller_task_runner_; |
| 45 } | 42 } |
| 46 | 43 |
| 47 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | 44 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 | 62 |
| 66 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); | 63 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 // Used to create |BasicDesktopEnvironment| instances. | 66 // Used to create |BasicDesktopEnvironment| instances. |
| 70 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | 67 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
| 71 public: | 68 public: |
| 72 BasicDesktopEnvironmentFactory( | 69 BasicDesktopEnvironmentFactory( |
| 73 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 74 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 75 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 76 const UiStrings& ui_strings); | |
| 77 virtual ~BasicDesktopEnvironmentFactory(); | 73 virtual ~BasicDesktopEnvironmentFactory(); |
| 78 | 74 |
| 79 // DesktopEnvironmentFactory implementation. | 75 // DesktopEnvironmentFactory implementation. |
| 80 virtual bool SupportsAudioCapture() const OVERRIDE; | 76 virtual bool SupportsAudioCapture() const OVERRIDE; |
| 81 | 77 |
| 82 protected: | 78 protected: |
| 83 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | 79 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
| 84 return caller_task_runner_; | 80 return caller_task_runner_; |
| 85 } | 81 } |
| 86 | 82 |
| 87 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | 83 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
| 88 return input_task_runner_; | 84 return input_task_runner_; |
| 89 } | 85 } |
| 90 | 86 |
| 91 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | 87 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
| 92 return ui_task_runner_; | 88 return ui_task_runner_; |
| 93 } | 89 } |
| 94 | 90 |
| 95 const UiStrings& ui_strings() const { return ui_strings_; } | |
| 96 | |
| 97 private: | 91 private: |
| 98 // Task runner on which methods of DesktopEnvironmentFactory interface should | 92 // Task runner on which methods of DesktopEnvironmentFactory interface should |
| 99 // be called. | 93 // be called. |
| 100 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 94 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 101 | 95 |
| 102 // Used to run input-related tasks. | 96 // Used to run input-related tasks. |
| 103 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 97 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 104 | 98 |
| 105 // Used to run UI code. | 99 // Used to run UI code. |
| 106 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 100 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 107 | 101 |
| 108 // Contains a copy of the localized UI strings. | |
| 109 const UiStrings ui_strings_; | |
| 110 | |
| 111 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); | 102 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
| 112 }; | 103 }; |
| 113 | 104 |
| 114 } // namespace remoting | 105 } // namespace remoting |
| 115 | 106 |
| 116 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 107 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
| OLD | NEW |