summaryrefslogtreecommitdiffstats
path: root/remoting/host/curtain_mode.h
blob: 002fc11f68864177d49407f86189a9f8b279e9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_HOST_CURTAIN_MODE_H_
#define REMOTING_HOST_CURTAIN_MODE_H_

#include <string>

#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"

namespace remoting {

class ChromotingHost;

class CurtainMode {
 public:
  virtual ~CurtainMode() {}

  // Creates a CurtainMode object, with callbacks to be invoked when the
  // switched-out session is switched back to the console, or in case of errors
  // activating the curtain. Typically, remote clients should be disconnected in
  // both cases: for errors, because the privacy guarantee of curtain-mode
  // cannot be honoured; for switch-in, to ensure that only one connection
  // (console or remote) exists to a session.
  static scoped_ptr<CurtainMode> Create(
      const base::Closure& on_session_activate,
      const base::Closure& on_error);

  // Activate or deactivate curtain mode.
  // If activated is true (meaning a remote client has just logged in), the
  // implementation must immediately activate the curtain, or call on_error if
  // it cannot do so. If a console user logs in while the curtain is activated,
  // the implementation must call on_session_activate (from any thread).
  // If activated is false (meaning the remote client has disconnected), the
  // implementation must not remove the curtain (since at this point we can make
  // no guarantees about whether the user intended to leave the console locked),
  // and must not call on_session_activate when the console user logs in.
  virtual void SetActivated(bool activated) = 0;

 protected:
  CurtainMode() {}

 private:
  DISALLOW_COPY_AND_ASSIGN(CurtainMode);
};

}  // namespace remoting

#endif