| 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 "jingle/notifier/communicator/connection_settings.h" | 5 #include "jingle/notifier/communicator/connection_settings.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 | 8 | 
| 9 // Ideally we shouldn't include anything from talk/p2p, but we need | 9 // Ideally we shouldn't include anything from talk/p2p, but we need | 
| 10 // the definition of ProtocolType.  Don't use any functions from | 10 // the definition of ProtocolType.  Don't use any functions from | 
| 11 // port.h, since it won't link. | 11 // port.h, since it won't link. | 
| 12 #include "talk/p2p/base/port.h" | 12 #include "talk/p2p/base/port.h" | 
| 13 | 13 | 
| 14 #include "talk/xmpp/xmppclientsettings.h" | 14 #include "talk/xmpp/xmppclientsettings.h" | 
| 15 | 15 | 
| 16 namespace notifier { | 16 namespace notifier { | 
| 17 | 17 | 
| 18 const uint16 kSslTcpPort = 443; | 18 const uint16 kSslTcpPort = 443; | 
| 19 | 19 | 
| 20 ConnectionSettings::ConnectionSettings( | 20 ConnectionSettings::ConnectionSettings( | 
| 21     const talk_base::SocketAddress& server, | 21     const rtc::SocketAddress& server, | 
| 22     SslTcpMode ssltcp_mode, | 22     SslTcpMode ssltcp_mode, | 
| 23     SslTcpSupport ssltcp_support) | 23     SslTcpSupport ssltcp_support) | 
| 24     : server(server), | 24     : server(server), | 
| 25       ssltcp_mode(ssltcp_mode), | 25       ssltcp_mode(ssltcp_mode), | 
| 26       ssltcp_support(ssltcp_support) {} | 26       ssltcp_support(ssltcp_support) {} | 
| 27 | 27 | 
| 28 ConnectionSettings::ConnectionSettings() | 28 ConnectionSettings::ConnectionSettings() | 
| 29     : ssltcp_mode(DO_NOT_USE_SSLTCP), | 29     : ssltcp_mode(DO_NOT_USE_SSLTCP), | 
| 30       ssltcp_support(DOES_NOT_SUPPORT_SSLTCP) {} | 30       ssltcp_support(DOES_NOT_SUPPORT_SSLTCP) {} | 
| 31 | 31 | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 69 } | 69 } | 
| 70 | 70 | 
| 71 ConnectionSettingsList MakeConnectionSettingsList( | 71 ConnectionSettingsList MakeConnectionSettingsList( | 
| 72     const ServerList& servers, | 72     const ServerList& servers, | 
| 73     bool try_ssltcp_first) { | 73     bool try_ssltcp_first) { | 
| 74   ConnectionSettingsList settings_list; | 74   ConnectionSettingsList settings_list; | 
| 75 | 75 | 
| 76   for (ServerList::const_iterator it = servers.begin(); | 76   for (ServerList::const_iterator it = servers.begin(); | 
| 77        it != servers.end(); ++it) { | 77        it != servers.end(); ++it) { | 
| 78     const ConnectionSettings settings( | 78     const ConnectionSettings settings( | 
| 79         talk_base::SocketAddress(it->server.host(), it->server.port()), | 79         rtc::SocketAddress(it->server.host(), it->server.port()), | 
| 80         DO_NOT_USE_SSLTCP, it->ssltcp_support); | 80         DO_NOT_USE_SSLTCP, it->ssltcp_support); | 
| 81 | 81 | 
| 82     if (it->ssltcp_support == SUPPORTS_SSLTCP) { | 82     if (it->ssltcp_support == SUPPORTS_SSLTCP) { | 
| 83       const ConnectionSettings settings_with_ssltcp( | 83       const ConnectionSettings settings_with_ssltcp( | 
| 84         talk_base::SocketAddress(it->server.host(), kSslTcpPort), | 84         rtc::SocketAddress(it->server.host(), kSslTcpPort), | 
| 85         USE_SSLTCP, it->ssltcp_support); | 85         USE_SSLTCP, it->ssltcp_support); | 
| 86 | 86 | 
| 87       if (try_ssltcp_first) { | 87       if (try_ssltcp_first) { | 
| 88         settings_list.push_back(settings_with_ssltcp); | 88         settings_list.push_back(settings_with_ssltcp); | 
| 89         settings_list.push_back(settings); | 89         settings_list.push_back(settings); | 
| 90       } else { | 90       } else { | 
| 91         settings_list.push_back(settings); | 91         settings_list.push_back(settings); | 
| 92         settings_list.push_back(settings_with_ssltcp); | 92         settings_list.push_back(settings_with_ssltcp); | 
| 93       } | 93       } | 
| 94     } else { | 94     } else { | 
| 95       settings_list.push_back(settings); | 95       settings_list.push_back(settings); | 
| 96     } | 96     } | 
| 97   } | 97   } | 
| 98 | 98 | 
| 99   return settings_list; | 99   return settings_list; | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 }  // namespace notifier | 102 }  // namespace notifier | 
| OLD | NEW | 
|---|