| 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/mouse_clamping_filter.h" |
| 13 #include "remoting/host/remote_input_filter.h" | 14 #include "remoting/host/remote_input_filter.h" |
| 14 #include "remoting/protocol/clipboard_echo_filter.h" | 15 #include "remoting/protocol/clipboard_echo_filter.h" |
| 15 #include "remoting/protocol/clipboard_filter.h" | 16 #include "remoting/protocol/clipboard_filter.h" |
| 16 #include "remoting/protocol/clipboard_stub.h" | 17 #include "remoting/protocol/clipboard_stub.h" |
| 17 #include "remoting/protocol/connection_to_client.h" | 18 #include "remoting/protocol/connection_to_client.h" |
| 18 #include "remoting/protocol/host_stub.h" | 19 #include "remoting/protocol/host_stub.h" |
| 19 #include "remoting/protocol/input_event_tracker.h" | 20 #include "remoting/protocol/input_event_tracker.h" |
| 20 #include "remoting/protocol/input_filter.h" | 21 #include "remoting/protocol/input_filter.h" |
| 21 #include "remoting/protocol/input_stub.h" | 22 #include "remoting/protocol/input_stub.h" |
| 22 #include "remoting/protocol/mouse_input_filter.h" | |
| 23 #include "third_party/skia/include/core/SkPoint.h" | 23 #include "third_party/skia/include/core/SkPoint.h" |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 | 26 |
| 27 class VideoFrameCapturer; | 27 class VideoFrameCapturer; |
| 28 | 28 |
| 29 // A ClientSession keeps a reference to a connection to a client, and maintains | 29 // A ClientSession keeps a reference to a connection to a client, and maintains |
| 30 // per-client state. | 30 // per-client state. |
| 31 class ClientSession : public protocol::HostStub, | 31 class ClientSession : public protocol::HostStub, |
| 32 public protocol::InputStub, | |
| 33 public protocol::ConnectionToClient::EventHandler, | 32 public protocol::ConnectionToClient::EventHandler, |
| 34 public base::NonThreadSafe { | 33 public base::NonThreadSafe { |
| 35 public: | 34 public: |
| 36 // Callback interface for passing events to the ChromotingHost. | 35 // Callback interface for passing events to the ChromotingHost. |
| 37 class EventHandler { | 36 class EventHandler { |
| 38 public: | 37 public: |
| 39 // Called after authentication has finished successfully. | 38 // Called after authentication has finished successfully. |
| 40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 39 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
| 41 | 40 |
| 42 // Called after we've finished connecting all channels. | 41 // Called after we've finished connecting all channels. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 ClientSession(EventHandler* event_handler, | 68 ClientSession(EventHandler* event_handler, |
| 70 scoped_ptr<protocol::ConnectionToClient> connection, | 69 scoped_ptr<protocol::ConnectionToClient> connection, |
| 71 protocol::ClipboardStub* host_clipboard_stub, | 70 protocol::ClipboardStub* host_clipboard_stub, |
| 72 protocol::InputStub* host_input_stub, | 71 protocol::InputStub* host_input_stub, |
| 73 VideoFrameCapturer* capturer, | 72 VideoFrameCapturer* capturer, |
| 74 const base::TimeDelta& max_duration); | 73 const base::TimeDelta& max_duration); |
| 75 virtual ~ClientSession(); | 74 virtual ~ClientSession(); |
| 76 | 75 |
| 77 // protocol::InputStub interface. | |
| 78 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | |
| 79 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | |
| 80 | |
| 81 // protocol::HostStub interface. | 76 // protocol::HostStub interface. |
| 82 virtual void NotifyClientDimensions( | 77 virtual void NotifyClientDimensions( |
| 83 const protocol::ClientDimensions& dimensions) OVERRIDE; | 78 const protocol::ClientDimensions& dimensions) OVERRIDE; |
| 84 virtual void ControlVideo( | 79 virtual void ControlVideo( |
| 85 const protocol::VideoControl& video_control) OVERRIDE; | 80 const protocol::VideoControl& video_control) OVERRIDE; |
| 86 | 81 |
| 87 // protocol::ConnectionToClient::EventHandler interface. | 82 // protocol::ConnectionToClient::EventHandler interface. |
| 88 virtual void OnConnectionAuthenticated( | 83 virtual void OnConnectionAuthenticated( |
| 89 protocol::ConnectionToClient* connection) OVERRIDE; | 84 protocol::ConnectionToClient* connection) OVERRIDE; |
| 90 virtual void OnConnectionChannelsConnected( | 85 virtual void OnConnectionChannelsConnected( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 protocol::ClipboardStub* host_clipboard_stub_; | 133 protocol::ClipboardStub* host_clipboard_stub_; |
| 139 protocol::InputStub* host_input_stub_; | 134 protocol::InputStub* host_input_stub_; |
| 140 | 135 |
| 141 // Tracker used to release pressed keys and buttons when disconnecting. | 136 // Tracker used to release pressed keys and buttons when disconnecting. |
| 142 protocol::InputEventTracker input_tracker_; | 137 protocol::InputEventTracker input_tracker_; |
| 143 | 138 |
| 144 // Filter used to disable remote inputs during local input activity. | 139 // Filter used to disable remote inputs during local input activity. |
| 145 RemoteInputFilter remote_input_filter_; | 140 RemoteInputFilter remote_input_filter_; |
| 146 | 141 |
| 147 // Filter used to clamp mouse events to the current display dimensions. | 142 // Filter used to clamp mouse events to the current display dimensions. |
| 148 protocol::MouseInputFilter mouse_input_filter_; | 143 MouseClampingFilter mouse_clamping_filter_; |
| 149 | 144 |
| 150 // Filter to used to stop clipboard items sent from the client being echoed | 145 // Filter to used to stop clipboard items sent from the client being echoed |
| 151 // back to it. | 146 // back to it. |
| 152 protocol::ClipboardEchoFilter clipboard_echo_filter_; | 147 protocol::ClipboardEchoFilter clipboard_echo_filter_; |
| 153 | 148 |
| 154 // Filters used to manage enabling & disabling of input & clipboard. | 149 // Filters used to manage enabling & disabling of input & clipboard. |
| 155 protocol::InputFilter disable_input_filter_; | 150 protocol::InputFilter disable_input_filter_; |
| 156 protocol::ClipboardFilter disable_clipboard_filter_; | 151 protocol::ClipboardFilter disable_clipboard_filter_; |
| 157 | 152 |
| 158 // Filters used to disable input & clipboard when we're not authenticated. | 153 // Filters used to disable input & clipboard when we're not authenticated. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 177 // A timer that triggers a disconnect when the maximum session duration | 172 // A timer that triggers a disconnect when the maximum session duration |
| 178 // is reached. | 173 // is reached. |
| 179 base::OneShotTimer<ClientSession> max_duration_timer_; | 174 base::OneShotTimer<ClientSession> max_duration_timer_; |
| 180 | 175 |
| 181 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 176 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 182 }; | 177 }; |
| 183 | 178 |
| 184 } // namespace remoting | 179 } // namespace remoting |
| 185 | 180 |
| 186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 181 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |