Home | History | Annotate | Download | only in host
      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.
      4 
      5 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
      6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
      7 
      8 #include <string>
      9 
     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"
     15 
     16 namespace base {
     17 class SingleThreadTaskRunner;
     18 }  // namespace base
     19 
     20 namespace webrtc {
     21 class ScreenCapturer;
     22 }  // namespace webrtc
     23 
     24 namespace remoting {
     25 
     26 namespace protocol {
     27 class ClientStub;
     28 }  // namespace protocol
     29 
     30 class AudioCapturer;
     31 class ClientSessionControl;
     32 class GnubbyAuthHandler;
     33 class InputInjector;
     34 class ScreenControls;
     35 
     36 // Provides factory methods for creation of audio/video capturers and event
     37 // executor for a given desktop environment.
     38 class DesktopEnvironment {
     39  public:
     40   virtual ~DesktopEnvironment() {}
     41 
     42   // Factory methods used to create audio/video capturers, event executor, and
     43   // screen controls object for a particular desktop environment.
     44   virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() = 0;
     45   virtual scoped_ptr<InputInjector> CreateInputInjector() = 0;
     46   virtual scoped_ptr<ScreenControls> CreateScreenControls() = 0;
     47   virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() = 0;
     48 
     49   // Returns the set of all capabilities supported by |this|.
     50   virtual std::string GetCapabilities() const = 0;
     51 
     52   // Passes the final set of capabilities negotiated between the client and host
     53   // to |this|.
     54   virtual void SetCapabilities(const std::string& capabilities) = 0;
     55 
     56   // Factory method to create a gnubby auth handler suitable for the particular
     57   // desktop environment.
     58   virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler(
     59       protocol::ClientStub* client_stub) = 0;
     60 };
     61 
     62 // Used to create |DesktopEnvironment| instances.
     63 class DesktopEnvironmentFactory {
     64  public:
     65   virtual ~DesktopEnvironmentFactory() {}
     66 
     67   // Creates an instance of |DesktopEnvironment|. Returns a NULL pointer if
     68   // the desktop environment could not be created for any reason (if the curtain
     69   // failed to active for instance). |client_session_control| must outlive
     70   // the created desktop environment.
     71   virtual scoped_ptr<DesktopEnvironment> Create(
     72       base::WeakPtr<ClientSessionControl> client_session_control) = 0;
     73 
     74   // Enables or disables the curtain mode.
     75   virtual void SetEnableCurtaining(bool enable) {}
     76 
     77   // Returns |true| if created |DesktopEnvironment| instances support audio
     78   // capture.
     79   virtual bool SupportsAudioCapture() const = 0;
     80 
     81   // Enables or disables gnubby authentication.
     82   virtual void SetEnableGnubbyAuth(bool enable) {}
     83 };
     84 
     85 }  // namespace remoting
     86 
     87 #endif  // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
     88