| 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/single_login_attempt.h" |
| 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include <limits> |
| 5 #include <string> | 10 #include <string> |
| 6 | 11 |
| 7 #include "jingle/notifier/communicator/single_login_attempt.h" | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 13 #include "jingle/notifier/base/const_communicator.h" | 15 #include "jingle/notifier/base/const_communicator.h" |
| 14 #include "jingle/notifier/base/gaia_token_pre_xmpp_auth.h" | 16 #include "jingle/notifier/base/gaia_token_pre_xmpp_auth.h" |
| 15 #include "jingle/notifier/listener/xml_element_util.h" | 17 #include "jingle/notifier/listener/xml_element_util.h" |
| 16 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
| 17 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 19 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 18 #include "webrtc/libjingle/xmpp/constants.h" | 20 #include "webrtc/libjingle/xmpp/constants.h" |
| 19 #include "webrtc/libjingle/xmpp/xmppclientsettings.h" | 21 #include "webrtc/libjingle/xmpp/xmppclientsettings.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 68 } |
| 67 redirect_server.set_host(parts[0]); | 69 redirect_server.set_host(parts[0]); |
| 68 if (parts.size() <= 1) { | 70 if (parts.size() <= 1) { |
| 69 return redirect_server; | 71 return redirect_server; |
| 70 } | 72 } |
| 71 // Try to parse the port, falling back to kDefaultXmppPort. | 73 // Try to parse the port, falling back to kDefaultXmppPort. |
| 72 int port = kDefaultXmppPort; | 74 int port = kDefaultXmppPort; |
| 73 if (!base::StringToInt(parts[1], &port)) { | 75 if (!base::StringToInt(parts[1], &port)) { |
| 74 port = kDefaultXmppPort; | 76 port = kDefaultXmppPort; |
| 75 } | 77 } |
| 76 if (port <= 0 || port > kuint16max) { | 78 if (port <= 0 || port > std::numeric_limits<uint16_t>::max()) { |
| 77 port = kDefaultXmppPort; | 79 port = kDefaultXmppPort; |
| 78 } | 80 } |
| 79 redirect_server.set_port(port); | 81 redirect_server.set_port(port); |
| 80 return redirect_server; | 82 return redirect_server; |
| 81 } | 83 } |
| 82 | 84 |
| 83 } // namespace | 85 } // namespace |
| 84 | 86 |
| 85 void SingleLoginAttempt::OnError(buzz::XmppEngine::Error error, int subcode, | 87 void SingleLoginAttempt::OnError(buzz::XmppEngine::Error error, int subcode, |
| 86 const buzz::XmlElement* stream_error) { | 88 const buzz::XmlElement* stream_error) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 client_settings.token_service(), | 175 client_settings.token_service(), |
| 174 login_settings_.auth_mechanism()); | 176 login_settings_.auth_mechanism()); |
| 175 xmpp_connection_.reset( | 177 xmpp_connection_.reset( |
| 176 new XmppConnection(client_settings, | 178 new XmppConnection(client_settings, |
| 177 login_settings_.request_context_getter(), | 179 login_settings_.request_context_getter(), |
| 178 this, | 180 this, |
| 179 pre_xmpp_auth)); | 181 pre_xmpp_auth)); |
| 180 } | 182 } |
| 181 | 183 |
| 182 } // namespace notifier | 184 } // namespace notifier |
| OLD | NEW |