| 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 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 context_->encode_message_loop(), | 166 context_->encode_message_loop(), |
| 167 context_->network_message_loop(), | 167 context_->network_message_loop(), |
| 168 desktop_environment_->capturer(), | 168 desktop_environment_->capturer(), |
| 169 encoder); | 169 encoder); |
| 170 | 170 |
| 171 // Immediately add the connection and start the session. | 171 // Immediately add the connection and start the session. |
| 172 recorder_->AddConnection(client->connection()); | 172 recorder_->AddConnection(client->connection()); |
| 173 recorder_->Start(); | 173 recorder_->Start(); |
| 174 | 174 |
| 175 // Notify observers that there is at least one authenticated client. | 175 // Notify observers that there is at least one authenticated client. |
| 176 const std::string& jid = client->connection()->session()->jid(); | 176 const std::string& jid = client->client_jid(); |
| 177 | 177 |
| 178 reject_authenticating_client_ = false; | 178 reject_authenticating_client_ = false; |
| 179 | 179 |
| 180 authenticating_client_ = true; | 180 authenticating_client_ = true; |
| 181 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 181 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
| 182 OnClientAuthenticated(jid)); | 182 OnClientAuthenticated(jid)); |
| 183 authenticating_client_ = false; | 183 authenticating_client_ = false; |
| 184 | 184 |
| 185 if (reject_authenticating_client_) { | 185 if (reject_authenticating_client_) { |
| 186 client->Disconnect(); | 186 client->Disconnect(); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { | 190 void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { |
| 191 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); | 191 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); |
| 192 | 192 |
| 193 // Notify observers. | 193 // Notify observers. |
| 194 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 194 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
| 195 OnAccessDenied()); | 195 OnAccessDenied(client->client_jid())); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ChromotingHost::OnSessionClosed(ClientSession* client) { | 198 void ChromotingHost::OnSessionClosed(ClientSession* client) { |
| 199 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); | 199 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); |
| 200 | 200 |
| 201 scoped_ptr<ClientSession> client_destroyer(client); | 201 scoped_ptr<ClientSession> client_destroyer(client); |
| 202 | 202 |
| 203 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); | 203 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); |
| 204 CHECK(it != clients_.end()); | 204 CHECK(it != clients_.end()); |
| 205 clients_.erase(it); | 205 clients_.erase(it); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 OnShutdown()); | 360 OnShutdown()); |
| 361 | 361 |
| 362 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 362 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
| 363 it != shutdown_tasks_.end(); ++it) { | 363 it != shutdown_tasks_.end(); ++it) { |
| 364 it->Run(); | 364 it->Run(); |
| 365 } | 365 } |
| 366 shutdown_tasks_.clear(); | 366 shutdown_tasks_.clear(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace remoting | 369 } // namespace remoting |
| OLD | NEW |