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_ME2ME_DESKTOP_ENVIRONMENT_H_
      6 #define REMOTING_HOST_ME2ME_DESKTOP_ENVIRONMENT_H_
      7 
      8 #include "remoting/host/basic_desktop_environment.h"
      9 
     10 namespace remoting {
     11 
     12 class CurtainMode;
     13 class HostWindow;
     14 class LocalInputMonitor;
     15 
     16 // Same as BasicDesktopEnvironment but supports desktop resizing and X DAMAGE
     17 // notifications on Linux.
     18 class Me2MeDesktopEnvironment : public BasicDesktopEnvironment {
     19  public:
     20   virtual ~Me2MeDesktopEnvironment();
     21 
     22   // DesktopEnvironment interface.
     23   virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE;
     24   virtual scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer() OVERRIDE;
     25   virtual std::string GetCapabilities() const OVERRIDE;
     26   virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler(
     27       protocol::ClientStub* client_stub) OVERRIDE;
     28 
     29  protected:
     30   friend class Me2MeDesktopEnvironmentFactory;
     31   Me2MeDesktopEnvironment(
     32       scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     33       scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     34       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
     35 
     36   // Initializes security features of the desktop environment (the curtain mode
     37   // and in-session UI).
     38   bool InitializeSecurity(
     39       base::WeakPtr<ClientSessionControl> client_session_control,
     40       bool curtain_enabled);
     41 
     42   void SetEnableGnubbyAuth(bool gnubby_auth_enabled);
     43 
     44  private:
     45   // "Curtains" the session making sure it is disconnected from the local
     46   // console.
     47   scoped_ptr<CurtainMode> curtain_;
     48 
     49   // Presents the disconnect window to the local user.
     50   scoped_ptr<HostWindow> disconnect_window_;
     51 
     52   // Notifies the client session about the local mouse movements.
     53   scoped_ptr<LocalInputMonitor> local_input_monitor_;
     54 
     55   // True if gnubby auth is enabled.
     56   bool gnubby_auth_enabled_;
     57 
     58   DISALLOW_COPY_AND_ASSIGN(Me2MeDesktopEnvironment);
     59 };
     60 
     61 // Used to create |Me2MeDesktopEnvironment| instances.
     62 class Me2MeDesktopEnvironmentFactory : public BasicDesktopEnvironmentFactory {
     63  public:
     64   Me2MeDesktopEnvironmentFactory(
     65       scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     66       scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     67       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
     68   virtual ~Me2MeDesktopEnvironmentFactory();
     69 
     70   // DesktopEnvironmentFactory interface.
     71   virtual scoped_ptr<DesktopEnvironment> Create(
     72       base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE;
     73   virtual void SetEnableCurtaining(bool enable) OVERRIDE;
     74   virtual void SetEnableGnubbyAuth(bool enable) OVERRIDE;
     75 
     76  protected:
     77   bool curtain_enabled() const { return curtain_enabled_; }
     78 
     79  private:
     80   // True if curtain mode is enabled.
     81   bool curtain_enabled_;
     82 
     83   // True if gnubby auth is enabled.
     84   bool gnubby_auth_enabled_;
     85 
     86   DISALLOW_COPY_AND_ASSIGN(Me2MeDesktopEnvironmentFactory);
     87 };
     88 
     89 }  // namespace remoting
     90 
     91 #endif  // REMOTING_HOST_ME2ME_DESKTOP_ENVIRONMENT_H_
     92