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 <string> | 5 #include <string> |
6 | 6 |
7 #include "jingle/notifier/communicator/single_login_attempt.h" | 7 #include "jingle/notifier/communicator/single_login_attempt.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 delegate_->OnConnect(base_task); | 50 delegate_->OnConnect(base_task); |
51 } | 51 } |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // This function is more permissive than | 55 // This function is more permissive than |
56 // net::HostPortPair::FromString(). If the port is missing or | 56 // net::HostPortPair::FromString(). If the port is missing or |
57 // unparseable, it assumes the default XMPP port. The hostname may be | 57 // unparseable, it assumes the default XMPP port. The hostname may be |
58 // empty. | 58 // empty. |
59 net::HostPortPair ParseRedirectText(const std::string& redirect_text) { | 59 net::HostPortPair ParseRedirectText(const std::string& redirect_text) { |
60 std::vector<std::string> parts; | 60 std::vector<std::string> parts = base::SplitString( |
61 base::SplitString(redirect_text, ':', &parts); | 61 redirect_text, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
62 net::HostPortPair redirect_server; | 62 net::HostPortPair redirect_server; |
63 redirect_server.set_port(kDefaultXmppPort); | 63 redirect_server.set_port(kDefaultXmppPort); |
64 if (parts.empty()) { | 64 if (parts.empty()) { |
65 return redirect_server; | 65 return redirect_server; |
66 } | 66 } |
67 redirect_server.set_host(parts[0]); | 67 redirect_server.set_host(parts[0]); |
68 if (parts.size() <= 1) { | 68 if (parts.size() <= 1) { |
69 return redirect_server; | 69 return redirect_server; |
70 } | 70 } |
71 // Try to parse the port, falling back to kDefaultXmppPort. | 71 // Try to parse the port, falling back to kDefaultXmppPort. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 client_settings.token_service(), | 173 client_settings.token_service(), |
174 login_settings_.auth_mechanism()); | 174 login_settings_.auth_mechanism()); |
175 xmpp_connection_.reset( | 175 xmpp_connection_.reset( |
176 new XmppConnection(client_settings, | 176 new XmppConnection(client_settings, |
177 login_settings_.request_context_getter(), | 177 login_settings_.request_context_getter(), |
178 this, | 178 this, |
179 pre_xmpp_auth)); | 179 pre_xmpp_auth)); |
180 } | 180 } |
181 | 181 |
182 } // namespace notifier | 182 } // namespace notifier |
OLD | NEW |