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