blob: 131cc70737e203fbe0b7a0e0d0254b16ce1ab689 (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// 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_CLIENT_SESSION_H_
#define REMOTING_HOST_CLIENT_SESSION_H_
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/input_stub.h"
namespace remoting {
class UserAuthenticator;
// A ClientSession keeps a reference to a connection to a client, and maintains
// per-client state.
class ClientSession : public protocol::HostStub,
public protocol::InputStub,
public base::RefCountedThreadSafe<ClientSession> {
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(
scoped_refptr<protocol::ConnectionToClient> client) = 0;
// Called to signal that local login has failed.
virtual void LocalLoginFailed(
scoped_refptr<protocol::ConnectionToClient> client) = 0;
};
ClientSession(EventHandler* event_handler,
UserAuthenticator* user_authenticator,
scoped_refptr<protocol::ConnectionToClient> connection,
protocol::InputStub* input_stub);
// protocol::HostStub interface.
virtual void SuggestResolution(
const protocol::SuggestResolutionRequest* msg, Task* done);
virtual void BeginSessionRequest(
const protocol::LocalLoginCredentials* credentials, Task* done);
// protocol::InputStub interface.
virtual void InjectKeyEvent(const protocol::KeyEvent* event, Task* done);
virtual void InjectMouseEvent(const protocol::MouseEvent* event, Task* done);
// Disconnect this client session.
void Disconnect();
protocol::ConnectionToClient* connection() const {
return connection_.get();
}
bool authenticated() const {
return authenticated_;
}
private:
friend class base::RefCountedThreadSafe<ClientSession>;
virtual ~ClientSession();
EventHandler* event_handler_;
// A factory for user authenticators.
scoped_ptr<UserAuthenticator> user_authenticator_;
// The connection to the client.
scoped_refptr<protocol::ConnectionToClient> connection_;
// The input stub to which this object delegates.
protocol::InputStub* input_stub_;
// Whether this client is authenticated.
bool authenticated_;
DISALLOW_COPY_AND_ASSIGN(ClientSession);
};
} // namespace remoting
#endif // REMOTING_HOST_CLIENT_SESSION_H_
|