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