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_DESKTOP_ENVIRONMENT_H_
6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
17 class SingleThreadTaskRunner
;
21 class DesktopCapturer
;
22 class MouseCursorMonitor
;
29 } // namespace protocol
32 class ClientSessionControl
;
33 class GnubbyAuthHandler
;
37 // Provides factory methods for creation of audio/video capturers and event
38 // executor for a given desktop environment.
39 class DesktopEnvironment
{
41 virtual ~DesktopEnvironment() {}
43 // Factory methods used to create audio/video capturers, event executor, and
44 // screen controls object for a particular desktop environment.
45 virtual scoped_ptr
<AudioCapturer
> CreateAudioCapturer() = 0;
46 virtual scoped_ptr
<InputInjector
> CreateInputInjector() = 0;
47 virtual scoped_ptr
<ScreenControls
> CreateScreenControls() = 0;
48 virtual scoped_ptr
<webrtc::DesktopCapturer
> CreateVideoCapturer() = 0;
49 virtual scoped_ptr
<webrtc::MouseCursorMonitor
> CreateMouseCursorMonitor() = 0;
51 // Returns the set of all capabilities supported by |this|.
52 virtual std::string
GetCapabilities() const = 0;
54 // Passes the final set of capabilities negotiated between the client and host
56 virtual void SetCapabilities(const std::string
& capabilities
) = 0;
58 // Factory method to create a gnubby auth handler suitable for the particular
59 // desktop environment.
60 virtual scoped_ptr
<GnubbyAuthHandler
> CreateGnubbyAuthHandler(
61 protocol::ClientStub
* client_stub
) = 0;
64 // Used to create |DesktopEnvironment| instances.
65 class DesktopEnvironmentFactory
{
67 virtual ~DesktopEnvironmentFactory() {}
69 // Creates an instance of |DesktopEnvironment|. Returns a nullptr pointer if
70 // the desktop environment could not be created for any reason (if the curtain
71 // failed to active for instance). |client_session_control| must outlive
72 // the created desktop environment.
73 virtual scoped_ptr
<DesktopEnvironment
> Create(
74 base::WeakPtr
<ClientSessionControl
> client_session_control
) = 0;
76 // Enables or disables the curtain mode.
77 virtual void SetEnableCurtaining(bool enable
) {}
79 // Returns |true| if created |DesktopEnvironment| instances support audio
81 virtual bool SupportsAudioCapture() const = 0;
83 // Enables or disables gnubby authentication.
84 virtual void SetEnableGnubbyAuth(bool enable
) {}
87 } // namespace remoting
89 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_