summaryrefslogtreecommitdiffstats
path: root/remoting/host/desktop_environment.h
blob: 745cf2f6dccd2c69dce16c9d8e1e1d5502a50de3 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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_DESKTOP_ENVIRONMENT_H_
#define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_

#include <string>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/host/event_executor.h"

namespace remoting {

class Capturer;
class ChromotingHostContext;

namespace protocol {
class ClipboardStub;
class HostEventStub;
};

class DesktopEnvironment {
 public:
  // Creates a DesktopEnvironment used in a host plugin.
  static scoped_ptr<DesktopEnvironment> Create(
      ChromotingHostContext* context);

  // Creates a DesktopEnvironment used in a service process.
  static scoped_ptr<DesktopEnvironment> CreateForService(
      ChromotingHostContext* context);

  static scoped_ptr<DesktopEnvironment> CreateFake(
      ChromotingHostContext* context,
      scoped_ptr<Capturer> capturer,
      scoped_ptr<EventExecutor> event_executor);

  virtual ~DesktopEnvironment();

  Capturer* capturer() const { return capturer_.get(); }
  EventExecutor* event_executor() const { return event_executor_.get(); }
  void OnSessionStarted(scoped_ptr<protocol::ClipboardStub> client_clipboard);
  void OnSessionFinished();

 private:
  DesktopEnvironment(ChromotingHostContext* context,
                     scoped_ptr<Capturer> capturer,
                     scoped_ptr<EventExecutor> event_executor);

  // Host context used to make sure operations are run on the correct thread.
  // This is owned by the ChromotingHost.
  ChromotingHostContext* context_;

  // Capturer to be used by ScreenRecorder.
  scoped_ptr<Capturer> capturer_;

  // Executes input and clipboard events received from the client.
  scoped_ptr<EventExecutor> event_executor_;

  DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment);
};

}  // namespace remoting

#endif  // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_