1 // Copyright 2016 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_OPTIONS_H_
6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_OPTIONS_H_
7 
8 #include <memory>
9 
10 #include "base/memory/weak_ptr.h"
11 #include "remoting/base/session_options.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
13 
14 namespace remoting {
15 
16 // A container of options a DesktopEnvironment or its derived classes need to
17 // control the behavior.
18 class DesktopEnvironmentOptions final {
19  public:
20   // Returns instance of DesktopEnvironmentOptions with default parameters, and
21   // initializes DesktopCaptureOptions by using
22   // DesktopCaptureOptions::CreateDefault().
23   static DesktopEnvironmentOptions CreateDefault();
24 
25   DesktopEnvironmentOptions();
26   DesktopEnvironmentOptions(DesktopEnvironmentOptions&& other);
27   DesktopEnvironmentOptions(const DesktopEnvironmentOptions& other);
28   ~DesktopEnvironmentOptions();
29 
30   DesktopEnvironmentOptions& operator=(DesktopEnvironmentOptions&& other);
31   DesktopEnvironmentOptions& operator=(const DesktopEnvironmentOptions& other);
32 
33   bool enable_curtaining() const;
34   void set_enable_curtaining(bool enabled);
35 
36   bool enable_user_interface() const;
37   void set_enable_user_interface(bool enabled);
38 
39   bool enable_notifications() const;
40   void set_enable_notifications(bool enabled);
41 
42   bool terminate_upon_input() const;
43   void set_terminate_upon_input(bool enabled);
44 
45   bool enable_file_transfer() const;
46   void set_enable_file_transfer(bool enabled);
47 
48   const webrtc::DesktopCaptureOptions* desktop_capture_options() const;
49   webrtc::DesktopCaptureOptions* desktop_capture_options();
50 
51   // Reads configurations from a SessionOptions instance.
52   void ApplySessionOptions(const SessionOptions& options);
53 
54  private:
55   // Sets default values for default constructor and CreateDefault() function.
56   void Initialize();
57 
58   // True if the curtain mode should be enabled by the DesktopEnvironment
59   // instances. Note, not all DesktopEnvironments support curtain mode.
60   bool enable_curtaining_ = false;
61 
62   // True if a user-interactive window is showing up in it2me scenario.
63   bool enable_user_interface_ = true;
64 
65   // True if a notification should be shown when a remote user is connected.
66   bool enable_notifications_ = true;
67 
68   // True if the session should be terminated when local input is detected.
69   bool terminate_upon_input_ = false;
70 
71   // True if this host has file transfer enabled.
72   bool enable_file_transfer_ = false;
73 
74   // The DesktopCaptureOptions to initialize DesktopCapturer.
75   webrtc::DesktopCaptureOptions desktop_capture_options_;
76 };
77 
78 }  // namespace remoting
79 
80 #endif  // REMOTING_HOST_DESKTOP_ENVIRONMENT_OPTIONS_H_
81