Revert of Report viewport memory and timing correctly for Slimming Paint. (patchset...
[chromium-blink-merge.git] / remoting / host / basic_desktop_environment.h
blob6b6b8e25ede0e94a14c63af789926a45a7a8e130
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);
51 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
52 return caller_task_runner_;
55 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
56 return input_task_runner_;
59 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
60 return ui_task_runner_;
63 webrtc::DesktopCaptureOptions* desktop_capture_options() {
64 return desktop_capture_options_.get();
67 private:
68 // Task runner on which methods of DesktopEnvironment interface should be
69 // called.
70 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
72 // Used to run input-related tasks.
73 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
75 // Used to run UI code.
76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
78 // Options shared between |DesktopCapturer| and |MouseCursorMonitor|. It
79 // might contain expensive resources, thus justifying the sharing.
80 // Also: it's dynamically allocated to avoid having to bring in
81 // desktop_capture_options.h which brings in X11 headers which causes hard to
82 // find build errors.
83 scoped_ptr<webrtc::DesktopCaptureOptions> desktop_capture_options_;
85 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment);
88 // Used to create |BasicDesktopEnvironment| instances.
89 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
90 public:
91 BasicDesktopEnvironmentFactory(
92 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
93 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
94 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
95 ~BasicDesktopEnvironmentFactory() override;
97 // DesktopEnvironmentFactory implementation.
98 bool SupportsAudioCapture() const override;
100 protected:
101 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
102 return caller_task_runner_;
105 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
106 return input_task_runner_;
109 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
110 return ui_task_runner_;
113 private:
114 // Task runner on which methods of DesktopEnvironmentFactory interface should
115 // be called.
116 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
118 // Used to run input-related tasks.
119 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
121 // Used to run UI code.
122 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
124 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory);
127 } // namespace remoting
129 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_