extensionview: Update loadNextSrc comments.
[chromium-blink-merge.git] / remoting / host / basic_desktop_environment.h
bloba7c56139e0b6b6ac576a4fa89af899e263c16c3c
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.
5 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "remoting/host/desktop_environment.h"
16 namespace webrtc {
18 class DesktopCaptureOptions;
20 } // namespace webrtc
22 namespace remoting {
24 class GnubbyAuthHandler;
26 // Used to create audio/video capturers and event executor that work with
27 // the local console.
28 class BasicDesktopEnvironment : public DesktopEnvironment {
29 public:
30 ~BasicDesktopEnvironment() override;
32 // DesktopEnvironment implementation.
33 scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
34 scoped_ptr<InputInjector> CreateInputInjector() override;
35 scoped_ptr<ScreenControls> CreateScreenControls() override;
36 scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
37 scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() override;
38 std::string GetCapabilities() const override;
39 void SetCapabilities(const std::string& capabilities) override;
40 scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler(
41 protocol::ClientStub* client_stub) override;
43 protected:
44 friend class BasicDesktopEnvironmentFactory;
46 BasicDesktopEnvironment(
47 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
48 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
49 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
50 bool supports_touch_events);
52 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
53 return caller_task_runner_;
56 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
57 return input_task_runner_;
60 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
61 return ui_task_runner_;
64 webrtc::DesktopCaptureOptions* desktop_capture_options() {
65 return desktop_capture_options_.get();
68 private:
69 // Task runner on which methods of DesktopEnvironment interface should be
70 // called.
71 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
73 // Used to run input-related tasks.
74 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
76 // Used to run UI code.
77 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
79 // Options shared between |DesktopCapturer| 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_;
86 // True if the touch events capability should be offered.
87 const bool supports_touch_events_;
89 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment);
92 // Used to create |BasicDesktopEnvironment| instances.
93 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
94 public:
95 BasicDesktopEnvironmentFactory(
96 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
97 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
98 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
99 ~BasicDesktopEnvironmentFactory() override;
101 // DesktopEnvironmentFactory implementation.
102 bool SupportsAudioCapture() const override;
104 void set_supports_touch_events(bool enable) {
105 supports_touch_events_ = enable;
108 protected:
109 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
110 return caller_task_runner_;
113 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
114 return input_task_runner_;
117 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
118 return ui_task_runner_;
121 bool supports_touch_events() const { return supports_touch_events_; }
123 private:
124 // Task runner on which methods of DesktopEnvironmentFactory interface should
125 // be called.
126 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
128 // Used to run input-related tasks.
129 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
131 // Used to run UI code.
132 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
134 // True if the touch events capability should be offered by the
135 // DesktopEnvironment instances.
136 bool supports_touch_events_;
138 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory);
141 } // namespace remoting
143 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_