blob: f5de55b907b2e2b773bce0108096a39493e545d8 [file] [log] [blame]
[email protected]ce404ca2013-01-16 17:23:531// 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_BASIC_DESKTOP_ENVIRONMENT_H_
6#define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "base/memory/ref_counted.h"
[email protected]ce404ca2013-01-16 17:23:5311#include "remoting/host/desktop_environment.h"
[email protected]c308f5122013-04-05 03:32:0612#include "remoting/host/ui_strings.h"
[email protected]ce404ca2013-01-16 17:23:5313
14namespace remoting {
15
[email protected]c308f5122013-04-05 03:32:0616class HostWindow;
[email protected]b167a7b2013-03-25 18:34:4017class LocalInputMonitor;
18
[email protected]ce404ca2013-01-16 17:23:5319// Used to create audio/video capturers and event executor that work with
20// the local console.
[email protected]231316a2013-03-25 06:01:1221class BasicDesktopEnvironment : public DesktopEnvironment {
[email protected]ce404ca2013-01-16 17:23:5322 public:
[email protected]ce404ca2013-01-16 17:23:5323 virtual ~BasicDesktopEnvironment();
24
25 // DesktopEnvironment implementation.
[email protected]231316a2013-03-25 06:01:1226 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE;
27 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE;
28 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE;
29 virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE;
[email protected]ce404ca2013-01-16 17:23:5330
[email protected]da457fc2013-03-14 16:32:1231 protected:
32 friend class BasicDesktopEnvironmentFactory;
[email protected]c308f5122013-04-05 03:32:0633
34 // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that
35 // created |this|. |ui_strings| must outlive this object.
[email protected]231316a2013-03-25 06:01:1236 BasicDesktopEnvironment(
37 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
38 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
39 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
[email protected]c308f5122013-04-05 03:32:0640 base::WeakPtr<ClientSessionControl> client_session_control,
41 const UiStrings* ui_strings);
[email protected]231316a2013-03-25 06:01:1242
43 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
44 return caller_task_runner_;
45 }
46
47 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
48 return input_task_runner_;
49 }
50
51 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
52 return ui_task_runner_;
53 }
[email protected]74b08f8c2013-01-30 09:48:5954
[email protected]c308f5122013-04-05 03:32:0655 const UiStrings* ui_strings() const { return ui_strings_; }
56
[email protected]da457fc2013-03-14 16:32:1257 private:
[email protected]231316a2013-03-25 06:01:1258 // Task runner on which methods of DesktopEnvironment interface should be
59 // called.
60 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
61
62 // Used to run input-related tasks.
63 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
64
65 // Used to run UI code.
66 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
67
[email protected]c308f5122013-04-05 03:32:0668 // Presents the disconnect window to the local user.
69 scoped_ptr<HostWindow> disconnect_window_;
70
[email protected]b167a7b2013-03-25 18:34:4071 // Notifies the client session about the local mouse movements.
72 scoped_ptr<LocalInputMonitor> local_input_monitor_;
73
[email protected]c308f5122013-04-05 03:32:0674 // Points to the localized UI strings.
75 const UiStrings* ui_strings_;
76
[email protected]ce404ca2013-01-16 17:23:5377 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment);
78};
79
80// Used to create |BasicDesktopEnvironment| instances.
81class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
82 public:
[email protected]231316a2013-03-25 06:01:1283 BasicDesktopEnvironmentFactory(
84 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
85 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
[email protected]c308f5122013-04-05 03:32:0686 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
87 const UiStrings& ui_strings);
[email protected]ce404ca2013-01-16 17:23:5388 virtual ~BasicDesktopEnvironmentFactory();
89
90 // DesktopEnvironmentFactory implementation.
91 virtual scoped_ptr<DesktopEnvironment> Create(
[email protected]231316a2013-03-25 06:01:1292 base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE;
[email protected]ce404ca2013-01-16 17:23:5393 virtual bool SupportsAudioCapture() const OVERRIDE;
94
[email protected]231316a2013-03-25 06:01:1295 protected:
96 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
97 return caller_task_runner_;
98 }
99
100 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const {
101 return input_task_runner_;
102 }
103
104 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const {
105 return ui_task_runner_;
106 }
107
[email protected]c308f5122013-04-05 03:32:06108 const UiStrings& ui_strings() const { return ui_strings_; }
109
[email protected]ce404ca2013-01-16 17:23:53110 private:
[email protected]231316a2013-03-25 06:01:12111 // Task runner on which methods of DesktopEnvironmentFactory interface should
112 // be called.
113 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
114
115 // Used to run input-related tasks.
116 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
117
118 // Used to run UI code.
119 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
120
[email protected]c308f5122013-04-05 03:32:06121 // Contains a copy of the localized UI strings.
122 const UiStrings ui_strings_;
123
[email protected]ce404ca2013-01-16 17:23:53124 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory);
125};
126
127} // namespace remoting
128
129#endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_