| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signaling/xmpp_signal_strategy.h" | 5 #include "remoting/signaling/xmpp_signal_strategy.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 error_(OK), | 133 error_(OK), |
| 134 keep_alive_timer_( | 134 keep_alive_timer_( |
| 135 FROM_HERE, | 135 FROM_HERE, |
| 136 base::TimeDelta::FromSeconds(kKeepAliveIntervalSeconds), | 136 base::TimeDelta::FromSeconds(kKeepAliveIntervalSeconds), |
| 137 base::Bind(&Core::SendKeepAlive, base::Unretained(this)), | 137 base::Bind(&Core::SendKeepAlive, base::Unretained(this)), |
| 138 true) { | 138 true) { |
| 139 #if defined(NDEBUG) | 139 #if defined(NDEBUG) |
| 140 // Non-secure connections are allowed only for debugging. | 140 // Non-secure connections are allowed only for debugging. |
| 141 CHECK(xmpp_server_config_.use_tls); | 141 CHECK(xmpp_server_config_.use_tls); |
| 142 #endif | 142 #endif |
| 143 | |
| 144 // TODO(sergeyu): Support for direct connections without TLS is not | |
| 145 // implemented yet. | |
| 146 if (!xmpp_server_config_.use_tls) | |
| 147 NOTIMPLEMENTED(); | |
| 148 | |
| 149 // Port 5222 may be blocked by firewall. talk.google.com allows connections on | |
| 150 // port 443 which can be used instead of 5222. The webapp still requests to | |
| 151 // use port 5222 for backwards compatibility with older versions of the host | |
| 152 // that do not pass correct |use_fake_ssl_client_socket| value to | |
| 153 // XmppClientSocketFactory (and so cannot connect to port 443). In case we are | |
| 154 // connecting to talk.google.com try to use port 443 anyway. | |
| 155 // | |
| 156 // TODO(sergeyu): Once all hosts support connections on port 443 | |
| 157 // the webapp needs to be updated to request port 443 and these 2 lines can be | |
| 158 // removed. crbug.com/443384 | |
| 159 if (xmpp_server_config_.host == "talk.google.com" && | |
| 160 xmpp_server_config_.port == kDefaultXmppPort) { | |
| 161 xmpp_server_config_.port = kDefaultHttpsPort; | |
| 162 } | |
| 163 } | 143 } |
| 164 | 144 |
| 165 XmppSignalStrategy::Core::~Core() { | 145 XmppSignalStrategy::Core::~Core() { |
| 166 Disconnect(); | 146 Disconnect(); |
| 167 } | 147 } |
| 168 | 148 |
| 169 void XmppSignalStrategy::Core::Connect() { | 149 void XmppSignalStrategy::Core::Connect() { |
| 170 DCHECK(thread_checker_.CalledOnValidThread()); | 150 DCHECK(thread_checker_.CalledOnValidThread()); |
| 171 | 151 |
| 172 // Disconnect first if we are currently connected. | 152 // Disconnect first if we are currently connected. |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 std::string XmppSignalStrategy::GetNextId() { | 490 std::string XmppSignalStrategy::GetNextId() { |
| 511 return base::Uint64ToString(base::RandUint64()); | 491 return base::Uint64ToString(base::RandUint64()); |
| 512 } | 492 } |
| 513 | 493 |
| 514 void XmppSignalStrategy::SetAuthInfo(const std::string& username, | 494 void XmppSignalStrategy::SetAuthInfo(const std::string& username, |
| 515 const std::string& auth_token) { | 495 const std::string& auth_token) { |
| 516 core_->SetAuthInfo(username, auth_token); | 496 core_->SetAuthInfo(username, auth_token); |
| 517 } | 497 } |
| 518 | 498 |
| 519 } // namespace remoting | 499 } // namespace remoting |
| OLD | NEW |