OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "remoting/host/win/rdp_client.h" | 5 #include "remoting/host/win/rdp_client.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 void RdpClient::Core::Disconnect() { | 161 void RdpClient::Core::Disconnect() { |
162 if (!ui_task_runner_->BelongsToCurrentThread()) { | 162 if (!ui_task_runner_->BelongsToCurrentThread()) { |
163 ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Disconnect, this)); | 163 ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::Disconnect, this)); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 // The caller does not expect any notifications to be delivered after this | 167 // The caller does not expect any notifications to be delivered after this |
168 // point. | 168 // point. |
169 event_handler_ = NULL; | 169 event_handler_ = nullptr; |
170 | 170 |
171 // Gracefully shutdown the RDP connection. | 171 // Gracefully shutdown the RDP connection. |
172 if (rdp_client_window_) { | 172 if (rdp_client_window_) { |
173 self_ = this; | 173 self_ = this; |
174 rdp_client_window_->Disconnect(); | 174 rdp_client_window_->Disconnect(); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void RdpClient::Core::InjectSas() { | 178 void RdpClient::Core::InjectSas() { |
179 if (!ui_task_runner_->BelongsToCurrentThread()) { | 179 if (!ui_task_runner_->BelongsToCurrentThread()) { |
(...skipping 13 matching lines...) Expand all Loading... |
193 } | 193 } |
194 | 194 |
195 void RdpClient::Core::OnDisconnected() { | 195 void RdpClient::Core::OnDisconnected() { |
196 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 196 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
197 DCHECK(rdp_client_window_); | 197 DCHECK(rdp_client_window_); |
198 | 198 |
199 NotifyClosed(); | 199 NotifyClosed(); |
200 | 200 |
201 // Delay window destruction until no ActiveX control's code is on the stack. | 201 // Delay window destruction until no ActiveX control's code is on the stack. |
202 ui_task_runner_->DeleteSoon(FROM_HERE, rdp_client_window_.release()); | 202 ui_task_runner_->DeleteSoon(FROM_HERE, rdp_client_window_.release()); |
203 self_ = NULL; | 203 self_ = nullptr; |
204 } | 204 } |
205 | 205 |
206 RdpClient::Core::~Core() { | 206 RdpClient::Core::~Core() { |
207 DCHECK(!event_handler_); | 207 DCHECK(!event_handler_); |
208 DCHECK(!rdp_client_window_); | 208 DCHECK(!rdp_client_window_); |
209 } | 209 } |
210 | 210 |
211 void RdpClient::Core::NotifyConnected() { | 211 void RdpClient::Core::NotifyConnected() { |
212 if (!caller_task_runner_->BelongsToCurrentThread()) { | 212 if (!caller_task_runner_->BelongsToCurrentThread()) { |
213 caller_task_runner_->PostTask( | 213 caller_task_runner_->PostTask( |
214 FROM_HERE, base::Bind(&Core::NotifyConnected, this)); | 214 FROM_HERE, base::Bind(&Core::NotifyConnected, this)); |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 if (event_handler_) | 218 if (event_handler_) |
219 event_handler_->OnRdpConnected(); | 219 event_handler_->OnRdpConnected(); |
220 } | 220 } |
221 | 221 |
222 void RdpClient::Core::NotifyClosed() { | 222 void RdpClient::Core::NotifyClosed() { |
223 if (!caller_task_runner_->BelongsToCurrentThread()) { | 223 if (!caller_task_runner_->BelongsToCurrentThread()) { |
224 caller_task_runner_->PostTask( | 224 caller_task_runner_->PostTask( |
225 FROM_HERE, base::Bind(&Core::NotifyClosed, this)); | 225 FROM_HERE, base::Bind(&Core::NotifyClosed, this)); |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 if (event_handler_) { | 229 if (event_handler_) { |
230 RdpClient::EventHandler* event_handler = event_handler_; | 230 RdpClient::EventHandler* event_handler = event_handler_; |
231 event_handler_ = NULL; | 231 event_handler_ = nullptr; |
232 event_handler->OnRdpClosed(); | 232 event_handler->OnRdpClosed(); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 } // namespace remoting | 236 } // namespace remoting |
OLD | NEW |