| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/it2me/it2me_host.h" | 5 #include "remoting/host/it2me/it2me_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 11 #include "net/socket/client_socket_factory.h" | 11 #include "net/socket/client_socket_factory.h" |
| 12 #include "remoting/base/auto_thread.h" | 12 #include "remoting/base/auto_thread.h" |
| 13 #include "remoting/base/logging.h" |
| 13 #include "remoting/base/rsa_key_pair.h" | 14 #include "remoting/base/rsa_key_pair.h" |
| 14 #include "remoting/host/chromoting_host.h" | 15 #include "remoting/host/chromoting_host.h" |
| 15 #include "remoting/host/chromoting_host_context.h" | 16 #include "remoting/host/chromoting_host_context.h" |
| 16 #include "remoting/host/host_event_logger.h" | 17 #include "remoting/host/host_event_logger.h" |
| 17 #include "remoting/host/host_secret.h" | 18 #include "remoting/host/host_secret.h" |
| 18 #include "remoting/host/it2me_desktop_environment.h" | 19 #include "remoting/host/it2me_desktop_environment.h" |
| 19 #include "remoting/host/policy_hack/policy_watcher.h" | 20 #include "remoting/host/policy_hack/policy_watcher.h" |
| 20 #include "remoting/host/register_support_host_request.h" | 21 #include "remoting/host/register_support_host_request.h" |
| 21 #include "remoting/host/session_manager_factory.h" | 22 #include "remoting/host/session_manager_factory.h" |
| 22 #include "remoting/jingle_glue/network_settings.h" | 23 #include "remoting/jingle_glue/network_settings.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 new RegisterSupportHostRequest( | 174 new RegisterSupportHostRequest( |
| 174 signal_strategy.get(), host_key_pair_, directory_bot_jid_, | 175 signal_strategy.get(), host_key_pair_, directory_bot_jid_, |
| 175 base::Bind(&It2MeHost::OnReceivedSupportID, | 176 base::Bind(&It2MeHost::OnReceivedSupportID, |
| 176 base::Unretained(this)))); | 177 base::Unretained(this)))); |
| 177 | 178 |
| 178 // Beyond this point nothing can fail, so save the config and request. | 179 // Beyond this point nothing can fail, so save the config and request. |
| 179 signal_strategy_ = signal_strategy.Pass(); | 180 signal_strategy_ = signal_strategy.Pass(); |
| 180 register_request_ = register_request.Pass(); | 181 register_request_ = register_request.Pass(); |
| 181 | 182 |
| 182 // If NAT traversal is off then limit port range to allow firewall pin-holing. | 183 // If NAT traversal is off then limit port range to allow firewall pin-holing. |
| 183 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; | 184 LOG_INFO << "NAT state: " << nat_traversal_enabled_; |
| 184 NetworkSettings network_settings( | 185 NetworkSettings network_settings( |
| 185 nat_traversal_enabled_ ? | 186 nat_traversal_enabled_ ? |
| 186 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 187 NetworkSettings::NAT_TRAVERSAL_ENABLED : |
| 187 NetworkSettings::NAT_TRAVERSAL_DISABLED); | 188 NetworkSettings::NAT_TRAVERSAL_DISABLED); |
| 188 if (!nat_traversal_enabled_) { | 189 if (!nat_traversal_enabled_) { |
| 189 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 190 network_settings.min_port = NetworkSettings::kDefaultMinPort; |
| 190 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 191 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
| 191 } | 192 } |
| 192 | 193 |
| 193 // Create the host. | 194 // Create the host. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 host_->RejectAuthenticatingClient(); | 289 host_->RejectAuthenticatingClient(); |
| 289 Disconnect(); | 290 Disconnect(); |
| 290 return; | 291 return; |
| 291 } | 292 } |
| 292 | 293 |
| 293 std::string client_username = jid; | 294 std::string client_username = jid; |
| 294 size_t pos = client_username.find('/'); | 295 size_t pos = client_username.find('/'); |
| 295 if (pos != std::string::npos) | 296 if (pos != std::string::npos) |
| 296 client_username.replace(pos, std::string::npos, ""); | 297 client_username.replace(pos, std::string::npos, ""); |
| 297 | 298 |
| 298 LOG(INFO) << "Client " << client_username << " connected."; | 299 LOG_INFO << "Client " << client_username << " connected."; |
| 299 | 300 |
| 300 // Pass the client user name to the script object before changing state. | 301 // Pass the client user name to the script object before changing state. |
| 301 plugin_task_runner_->PostTask( | 302 plugin_task_runner_->PostTask( |
| 302 FROM_HERE, base::Bind(&It2MeHost::Observer::OnClientAuthenticated, | 303 FROM_HERE, base::Bind(&It2MeHost::Observer::OnClientAuthenticated, |
| 303 observer_, client_username)); | 304 observer_, client_username)); |
| 304 | 305 |
| 305 SetState(kConnected); | 306 SetState(kConnected); |
| 306 } | 307 } |
| 307 | 308 |
| 308 void It2MeHost::OnClientDisconnected(const std::string& jid) { | 309 void It2MeHost::OnClientDisconnected(const std::string& jid) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 455 |
| 455 // Pass the Access Code to the script object before changing state. | 456 // Pass the Access Code to the script object before changing state. |
| 456 plugin_task_runner_->PostTask( | 457 plugin_task_runner_->PostTask( |
| 457 FROM_HERE, base::Bind(&It2MeHost::Observer::OnStoreAccessCode, | 458 FROM_HERE, base::Bind(&It2MeHost::Observer::OnStoreAccessCode, |
| 458 observer_, access_code, lifetime)); | 459 observer_, access_code, lifetime)); |
| 459 | 460 |
| 460 SetState(kReceivedAccessCode); | 461 SetState(kReceivedAccessCode); |
| 461 } | 462 } |
| 462 | 463 |
| 463 } // namespace remoting | 464 } // namespace remoting |
| OLD | NEW |