OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
6 #define REMOTING_HOST_CLIENT_SESSION_H_ | 6 #define REMOTING_HOST_CLIENT_SESSION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "remoting/protocol/connection_to_client.h" | 12 #include "remoting/protocol/connection_to_client.h" |
13 #include "remoting/protocol/host_stub.h" | 13 #include "remoting/protocol/host_stub.h" |
14 #include "remoting/protocol/input_stub.h" | 14 #include "remoting/protocol/input_stub.h" |
15 #include "third_party/skia/include/core/SkPoint.h" | 15 #include "third_party/skia/include/core/SkPoint.h" |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 class Capturer; | 19 class Capturer; |
20 class UserAuthenticator; | |
21 | 20 |
22 // A ClientSession keeps a reference to a connection to a client, and maintains | 21 // A ClientSession keeps a reference to a connection to a client, and maintains |
23 // per-client state. | 22 // per-client state. |
24 class ClientSession : public protocol::HostStub, | 23 class ClientSession : public protocol::HostStub, |
25 public protocol::InputStub, | 24 public protocol::InputStub, |
26 public base::RefCountedThreadSafe<ClientSession> { | 25 public base::RefCountedThreadSafe<ClientSession> { |
27 public: | 26 public: |
28 // Callback interface for passing events to the ChromotingHost. | 27 // Callback interface for passing events to the ChromotingHost. |
29 class EventHandler { | 28 class EventHandler { |
30 public: | 29 public: |
31 virtual ~EventHandler() {} | 30 virtual ~EventHandler() {} |
32 | 31 |
33 // Called to signal that local login has succeeded and ChromotingHost can | 32 // Called to signal that local login has succeeded and ChromotingHost can |
Wez
2011/11/03 00:25:02
We don't have local login any more, so what does t
Sergey Ulanov
2011/11/03 01:21:12
changed to authentication. I'm going to refactor t
| |
34 // proceed with the next step. | 33 // proceed with the next step. |
35 virtual void LocalLoginSucceeded( | 34 virtual void OnAuthorizationComplete( |
36 scoped_refptr<protocol::ConnectionToClient> client) = 0; | |
37 | |
38 // Called to signal that local login has failed. | |
39 virtual void LocalLoginFailed( | |
40 scoped_refptr<protocol::ConnectionToClient> client) = 0; | 35 scoped_refptr<protocol::ConnectionToClient> client) = 0; |
41 }; | 36 }; |
42 | 37 |
43 // Takes ownership of |user_authenticator|. Does not take ownership of | 38 // Takes ownership of |user_authenticator|. Does not take ownership of |
44 // |event_handler|, |input_stub| or |capturer|. | 39 // |event_handler|, |input_stub| or |capturer|. |
45 ClientSession(EventHandler* event_handler, | 40 ClientSession(EventHandler* event_handler, |
46 UserAuthenticator* user_authenticator, | |
47 scoped_refptr<protocol::ConnectionToClient> connection, | 41 scoped_refptr<protocol::ConnectionToClient> connection, |
48 protocol::InputStub* input_stub, | 42 protocol::InputStub* input_stub, |
49 Capturer* capturer); | 43 Capturer* capturer); |
50 | 44 |
51 // protocol::HostStub interface. | |
52 virtual void BeginSessionRequest( | |
53 const protocol::LocalLoginCredentials* credentials, | |
54 const base::Closure& done); | |
55 | |
56 // protocol::InputStub interface. | 45 // protocol::InputStub interface. |
57 virtual void InjectKeyEvent(const protocol::KeyEvent& event); | 46 virtual void InjectKeyEvent(const protocol::KeyEvent& event); |
58 virtual void InjectMouseEvent(const protocol::MouseEvent& event); | 47 virtual void InjectMouseEvent(const protocol::MouseEvent& event); |
59 | 48 |
60 // Notifier called when the client is being disconnected. | 49 // Notifier called when the client is being disconnected. |
61 // This should only be called by ChromotingHost. | 50 // This should only be called by ChromotingHost. |
62 void OnDisconnected(); | 51 void OnDisconnected(); |
63 | 52 |
64 // Set the authenticated flag or log a failure message as appropriate. | 53 // Set the authenticated flag or log a failure message as appropriate. |
Wez
2011/11/03 00:25:02
Out-of-date comment.
Sergey Ulanov
2011/11/03 01:21:12
Done.
| |
65 void OnAuthorizationComplete(bool success); | 54 void OnAuthorizationComplete(); |
66 | 55 |
67 protocol::ConnectionToClient* connection() const { | 56 protocol::ConnectionToClient* connection() const { |
68 return connection_.get(); | 57 return connection_.get(); |
69 } | 58 } |
70 | 59 |
71 bool authenticated() const { | 60 bool authenticated() const { |
72 return authenticated_; | 61 return authenticated_; |
73 } | 62 } |
74 | 63 |
75 void set_awaiting_continue_approval(bool awaiting) { | 64 void set_awaiting_continue_approval(bool awaiting) { |
(...skipping 19 matching lines...) Expand all Loading... | |
95 // the user disconnects. | 84 // the user disconnects. |
96 void RecordKeyEvent(const protocol::KeyEvent& event); | 85 void RecordKeyEvent(const protocol::KeyEvent& event); |
97 void RecordMouseButtonState(const protocol::MouseEvent& event); | 86 void RecordMouseButtonState(const protocol::MouseEvent& event); |
98 | 87 |
99 // Synthesize KeyUp and MouseUp events so that we can undo these events | 88 // Synthesize KeyUp and MouseUp events so that we can undo these events |
100 // when the user disconnects. | 89 // when the user disconnects. |
101 void RestoreEventState(); | 90 void RestoreEventState(); |
102 | 91 |
103 EventHandler* event_handler_; | 92 EventHandler* event_handler_; |
104 | 93 |
105 // A factory for user authenticators. | |
106 scoped_ptr<UserAuthenticator> user_authenticator_; | |
107 | |
108 // The connection to the client. | 94 // The connection to the client. |
109 scoped_refptr<protocol::ConnectionToClient> connection_; | 95 scoped_refptr<protocol::ConnectionToClient> connection_; |
110 | 96 |
111 std::string client_jid_; | 97 std::string client_jid_; |
112 | 98 |
113 // The input stub to which this object delegates. | 99 // The input stub to which this object delegates. |
114 protocol::InputStub* input_stub_; | 100 protocol::InputStub* input_stub_; |
115 | 101 |
116 // Capturer, used to determine current screen size for ensuring injected | 102 // Capturer, used to determine current screen size for ensuring injected |
117 // mouse events fall within the screen area. | 103 // mouse events fall within the screen area. |
(...skipping 25 matching lines...) Expand all Loading... | |
143 // Set of keys that are currently pressed down by the user. This is used so | 129 // Set of keys that are currently pressed down by the user. This is used so |
144 // we can release them if the user disconnects. | 130 // we can release them if the user disconnects. |
145 std::set<int> pressed_keys_; | 131 std::set<int> pressed_keys_; |
146 | 132 |
147 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 133 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
148 }; | 134 }; |
149 | 135 |
150 } // namespace remoting | 136 } // namespace remoting |
151 | 137 |
152 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 138 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |