OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "remoting/host/remote_input_filter.h" | 13 #include "remoting/host/remote_input_filter.h" |
14 #include "remoting/protocol/clipboard_echo_filter.h" | 14 #include "remoting/protocol/clipboard_echo_filter.h" |
15 #include "remoting/protocol/clipboard_stub.h" | 15 #include "remoting/protocol/clipboard_stub.h" |
16 #include "remoting/protocol/connection_to_client.h" | 16 #include "remoting/protocol/connection_to_client.h" |
17 #include "remoting/protocol/host_event_stub.h" | |
18 #include "remoting/protocol/host_stub.h" | 17 #include "remoting/protocol/host_stub.h" |
19 #include "remoting/protocol/input_event_tracker.h" | 18 #include "remoting/protocol/input_event_tracker.h" |
20 #include "remoting/protocol/input_filter.h" | 19 #include "remoting/protocol/input_filter.h" |
21 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
22 #include "remoting/protocol/mouse_input_filter.h" | 21 #include "remoting/protocol/mouse_input_filter.h" |
23 #include "third_party/skia/include/core/SkPoint.h" | 22 #include "third_party/skia/include/core/SkPoint.h" |
24 | 23 |
25 namespace remoting { | 24 namespace remoting { |
26 | 25 |
27 class VideoFrameCapturer; | 26 class VideoFrameCapturer; |
28 | 27 |
29 // A ClientSession keeps a reference to a connection to a client, and maintains | 28 // A ClientSession keeps a reference to a connection to a client, and maintains |
30 // per-client state. | 29 // per-client state. |
31 class ClientSession : public protocol::HostEventStub, | 30 class ClientSession : public protocol::ClipboardStub, |
32 public protocol::HostStub, | 31 public protocol::HostStub, |
| 32 public protocol::InputStub, |
33 public protocol::ConnectionToClient::EventHandler, | 33 public protocol::ConnectionToClient::EventHandler, |
34 public base::NonThreadSafe { | 34 public base::NonThreadSafe { |
35 public: | 35 public: |
36 // Callback interface for passing events to the ChromotingHost. | 36 // Callback interface for passing events to the ChromotingHost. |
37 class EventHandler { | 37 class EventHandler { |
38 public: | 38 public: |
39 // Called after authentication has finished successfully. | 39 // Called after authentication has finished successfully. |
40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
41 | 41 |
42 // Called after we've finished connecting all channels. | 42 // Called after we've finished connecting all channels. |
(...skipping 18 matching lines...) Expand all Loading... |
61 ClientSession* client, | 61 ClientSession* client, |
62 const std::string& channel_name, | 62 const std::string& channel_name, |
63 const protocol::TransportRoute& route) = 0; | 63 const protocol::TransportRoute& route) = 0; |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~EventHandler() {} | 66 virtual ~EventHandler() {} |
67 }; | 67 }; |
68 | 68 |
69 ClientSession(EventHandler* event_handler, | 69 ClientSession(EventHandler* event_handler, |
70 scoped_ptr<protocol::ConnectionToClient> connection, | 70 scoped_ptr<protocol::ConnectionToClient> connection, |
71 protocol::HostEventStub* host_event_stub, | 71 protocol::ClipboardStub* host_clipboard_stub, |
| 72 protocol::InputStub* host_input_stub, |
72 VideoFrameCapturer* capturer, | 73 VideoFrameCapturer* capturer, |
73 const base::TimeDelta& max_duration); | 74 const base::TimeDelta& max_duration); |
74 virtual ~ClientSession(); | 75 virtual ~ClientSession(); |
75 | 76 |
76 // protocol::ClipboardStub interface. | 77 // protocol::ClipboardStub interface. |
77 virtual void InjectClipboardEvent( | 78 virtual void InjectClipboardEvent( |
78 const protocol::ClipboardEvent& event) OVERRIDE; | 79 const protocol::ClipboardEvent& event) OVERRIDE; |
79 | 80 |
80 // protocol::InputStub interface. | 81 // protocol::InputStub interface. |
81 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 82 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 private: | 131 private: |
131 EventHandler* event_handler_; | 132 EventHandler* event_handler_; |
132 | 133 |
133 // The connection to the client. | 134 // The connection to the client. |
134 scoped_ptr<protocol::ConnectionToClient> connection_; | 135 scoped_ptr<protocol::ConnectionToClient> connection_; |
135 | 136 |
136 std::string client_jid_; | 137 std::string client_jid_; |
137 bool is_authenticated_; | 138 bool is_authenticated_; |
138 | 139 |
139 // The host event stub to which this object delegates. This is the final | 140 // The host clipboard and input stubs to which this object delegates. |
140 // element in the input pipeline, whose components appear in order below. | 141 // These are the final elements in the clipboard & input pipelines, which |
141 protocol::HostEventStub* host_event_stub_; | 142 // appear in order below. |
| 143 protocol::ClipboardStub* host_clipboard_stub_; |
| 144 protocol::InputStub* host_input_stub_; |
142 | 145 |
143 // Tracker used to release pressed keys and buttons when disconnecting. | 146 // Tracker used to release pressed keys and buttons when disconnecting. |
144 protocol::InputEventTracker input_tracker_; | 147 protocol::InputEventTracker input_tracker_; |
145 | 148 |
146 // Filter used to disable remote inputs during local input activity. | 149 // Filter used to disable remote inputs during local input activity. |
147 RemoteInputFilter remote_input_filter_; | 150 RemoteInputFilter remote_input_filter_; |
148 | 151 |
149 // Filter used to clamp mouse events to the current display dimensions. | 152 // Filter used to clamp mouse events to the current display dimensions. |
150 protocol::MouseInputFilter mouse_input_filter_; | 153 protocol::MouseInputFilter mouse_input_filter_; |
151 | 154 |
(...skipping 25 matching lines...) Expand all Loading... |
177 // A timer that triggers a disconnect when the maximum session duration | 180 // A timer that triggers a disconnect when the maximum session duration |
178 // is reached. | 181 // is reached. |
179 base::OneShotTimer<ClientSession> max_duration_timer_; | 182 base::OneShotTimer<ClientSession> max_duration_timer_; |
180 | 183 |
181 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 184 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
182 }; | 185 }; |
183 | 186 |
184 } // namespace remoting | 187 } // namespace remoting |
185 | 188 |
186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 189 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |