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" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // be called multiple times. The object should not be used after | 103 // be called multiple times. The object should not be used after |
104 // this method returns. | 104 // this method returns. |
105 void Disconnect(); | 105 void Disconnect(); |
106 | 106 |
107 protocol::ConnectionToClient* connection() const { | 107 protocol::ConnectionToClient* connection() const { |
108 return connection_.get(); | 108 return connection_.get(); |
109 } | 109 } |
110 | 110 |
111 const std::string& client_jid() { return client_jid_; } | 111 const std::string& client_jid() { return client_jid_; } |
112 | 112 |
113 bool is_authenticated() { return is_authenticated_; } | 113 bool is_authenticated() { return auth_input_filter_.enabled(); } |
114 | 114 |
115 // Indicate that local mouse activity has been detected. This causes remote | 115 // Indicate that local mouse activity has been detected. This causes remote |
116 // inputs to be ignored for a short time so that the local user will always | 116 // inputs to be ignored for a short time so that the local user will always |
117 // have the upper hand in 'pointer wars'. | 117 // have the upper hand in 'pointer wars'. |
118 void LocalMouseMoved(const SkIPoint& new_pos); | 118 void LocalMouseMoved(const SkIPoint& new_pos); |
119 | 119 |
120 // Disable handling of input events from this client. If the client has any | 120 // Disable handling of input events from this client. If the client has any |
121 // keys or mouse buttons pressed then these will be released. | 121 // keys or mouse buttons pressed then these will be released. |
122 void SetDisableInputs(bool disable_inputs); | 122 void SetDisableInputs(bool disable_inputs); |
123 | 123 |
124 // Creates a proxy for sending clipboard events to the client. | 124 // Creates a proxy for sending clipboard events to the client. |
125 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); | 125 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
126 | 126 |
127 private: | 127 private: |
128 EventHandler* event_handler_; | 128 EventHandler* event_handler_; |
129 | 129 |
130 // The connection to the client. | 130 // The connection to the client. |
131 scoped_ptr<protocol::ConnectionToClient> connection_; | 131 scoped_ptr<protocol::ConnectionToClient> connection_; |
132 | 132 |
133 std::string client_jid_; | 133 std::string client_jid_; |
134 bool is_authenticated_; | |
135 | 134 |
136 // The host clipboard and input stubs to which this object delegates. | 135 // The host clipboard and input stubs to which this object delegates. |
137 // These are the final elements in the clipboard & input pipelines, which | 136 // These are the final elements in the clipboard & input pipelines, which |
138 // appear in order below. | 137 // appear in order below. |
139 protocol::ClipboardStub* host_clipboard_stub_; | 138 protocol::ClipboardStub* host_clipboard_stub_; |
140 protocol::InputStub* host_input_stub_; | 139 protocol::InputStub* host_input_stub_; |
141 | 140 |
142 // Tracker used to release pressed keys and buttons when disconnecting. | 141 // Tracker used to release pressed keys and buttons when disconnecting. |
143 protocol::InputEventTracker input_tracker_; | 142 protocol::InputEventTracker input_tracker_; |
144 | 143 |
145 // Filter used to disable remote inputs during local input activity. | 144 // Filter used to disable remote inputs during local input activity. |
146 RemoteInputFilter remote_input_filter_; | 145 RemoteInputFilter remote_input_filter_; |
147 | 146 |
148 // Filter used to clamp mouse events to the current display dimensions. | 147 // Filter used to clamp mouse events to the current display dimensions. |
149 protocol::MouseInputFilter mouse_input_filter_; | 148 protocol::MouseInputFilter mouse_input_filter_; |
150 | 149 |
| 150 // Filter to used to stop clipboard items sent from the client being echoed |
| 151 // back to it. |
| 152 protocol::ClipboardEchoFilter clipboard_echo_filter_; |
| 153 |
151 // Filters used to manage enabling & disabling of input & clipboard. | 154 // Filters used to manage enabling & disabling of input & clipboard. |
152 protocol::InputFilter disable_input_filter_; | 155 protocol::InputFilter disable_input_filter_; |
153 protocol::ClipboardFilter disable_clipboard_filter_; | 156 protocol::ClipboardFilter disable_clipboard_filter_; |
154 | 157 |
155 // Filters used to disable input & clipboard when we're not authenticated. | 158 // Filters used to disable input & clipboard when we're not authenticated. |
156 protocol::InputFilter auth_input_filter_; | 159 protocol::InputFilter auth_input_filter_; |
157 protocol::ClipboardFilter auth_clipboard_filter_; | 160 protocol::ClipboardFilter auth_clipboard_filter_; |
158 | 161 |
159 // Filter to used to stop clipboard items sent from the client being echoed | |
160 // back to it. | |
161 protocol::ClipboardEchoFilter clipboard_echo_filter_; | |
162 | |
163 // Factory for weak pointers to the client clipboard stub. | 162 // Factory for weak pointers to the client clipboard stub. |
164 // This must appear after |clipboard_echo_filter_|, so that it won't outlive | 163 // This must appear after |clipboard_echo_filter_|, so that it won't outlive |
165 // it. | 164 // it. |
166 base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; | 165 base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; |
167 | 166 |
168 // VideoFrameCapturer, used to determine current screen size for ensuring | 167 // VideoFrameCapturer, used to determine current screen size for ensuring |
169 // injected mouse events fall within the screen area. | 168 // injected mouse events fall within the screen area. |
170 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 169 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
171 // area, out of this class (crbug.com/96508). | 170 // area, out of this class (crbug.com/96508). |
172 VideoFrameCapturer* capturer_; | 171 VideoFrameCapturer* capturer_; |
173 | 172 |
174 // The maximum duration of this session. | 173 // The maximum duration of this session. |
175 // There is no maximum if this value is <= 0. | 174 // There is no maximum if this value is <= 0. |
176 base::TimeDelta max_duration_; | 175 base::TimeDelta max_duration_; |
177 | 176 |
178 // A timer that triggers a disconnect when the maximum session duration | 177 // A timer that triggers a disconnect when the maximum session duration |
179 // is reached. | 178 // is reached. |
180 base::OneShotTimer<ClientSession> max_duration_timer_; | 179 base::OneShotTimer<ClientSession> max_duration_timer_; |
181 | 180 |
182 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 181 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
183 }; | 182 }; |
184 | 183 |
185 } // namespace remoting | 184 } // namespace remoting |
186 | 185 |
187 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |