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