summaryrefslogtreecommitdiffstats
path: root/remoting/host/desktop_environment.h
blob: 90bab71eac624323f810a7ff66c25bc9ecd7db21 (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
67
68
// Copyright (c) 2011 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 "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "remoting/protocol/host_stub.h"

namespace remoting {

namespace protocol {
class InputStub;
}  // namespace protocol

class Capturer;

class DesktopEnvironment : public protocol::HostStub {
 public:
  // Callback interface for passing events to the ChromotingHost.
  class EventHandler {
   public:
    virtual ~EventHandler() {}

    // Called to signal that local login has succeeded and ChromotingHost can
    // proceed with the next step.
    virtual void LocalLoginSucceeded() = 0;

    // Called to signal that local login has failed.
    virtual void LocalLoginFailed() = 0;
  };

  DesktopEnvironment(Capturer* capturer, protocol::InputStub* input_stub);
  virtual ~DesktopEnvironment();

  Capturer* capturer() const { return capturer_.get(); }
  protocol::InputStub* input_stub() const { return input_stub_.get(); }
  // Called by ChromotingHost constructor
  void set_event_handler(EventHandler* event_handler) {
    event_handler_ = event_handler;
  }

  // protocol::HostStub interface.
  virtual void SuggestResolution(
      const protocol::SuggestResolutionRequest* msg, Task* done);
  virtual void BeginSessionRequest(
      const protocol::LocalLoginCredentials* credentials, Task* done);

 protected:
  // Allow access by DesktopEnvironmentFake for unittest.
  EventHandler* event_handler_;

 private:
  // Capturer to be used by ScreenRecorder. Once the ScreenRecorder is
  // constructed this is set to NULL.
  scoped_ptr<Capturer> capturer_;

  // InputStub in the host executes input events received from the client.
  scoped_ptr<protocol::InputStub> input_stub_;

  DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment);
};

}  // namespace remoting

#endif  // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_