OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login.h" |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "jingle/notifier/communicator/login.h" | |
8 | |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "jingle/notifier/communicator/connection_options.h" | 12 #include "jingle/notifier/communicator/connection_options.h" |
13 #include "jingle/notifier/communicator/login_settings.h" | 13 #include "jingle/notifier/communicator/login_settings.h" |
14 #include "jingle/notifier/communicator/single_login_attempt.h" | 14 #include "jingle/notifier/communicator/single_login_attempt.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "talk/base/common.h" | 16 #include "talk/base/common.h" |
17 #include "talk/base/firewallsocketserver.h" | 17 #include "talk/base/firewallsocketserver.h" |
18 #include "talk/base/logging.h" | 18 #include "talk/base/logging.h" |
19 #include "talk/base/physicalsocketserver.h" | 19 #include "talk/base/physicalsocketserver.h" |
20 #include "talk/base/taskrunner.h" | 20 #include "talk/base/taskrunner.h" |
21 #include "talk/xmllite/xmlelement.h" | 21 #include "talk/xmllite/xmlelement.h" |
22 #include "talk/xmpp/asyncsocket.h" | 22 #include "talk/xmpp/asyncsocket.h" |
23 #include "talk/xmpp/prexmppauth.h" | 23 #include "talk/xmpp/prexmppauth.h" |
24 #include "talk/xmpp/xmppclient.h" | 24 #include "talk/xmpp/xmppclient.h" |
25 #include "talk/xmpp/xmppclientsettings.h" | 25 #include "talk/xmpp/xmppclientsettings.h" |
26 #include "talk/xmpp/xmppengine.h" | 26 #include "talk/xmpp/xmppengine.h" |
27 | 27 |
28 namespace notifier { | 28 namespace notifier { |
29 | 29 |
30 // Redirect valid for 5 minutes. | 30 // Redirect valid for 5 minutes. |
31 static const int kRedirectTimeoutMinutes = 5; | 31 static const int kRedirectTimeoutMinutes = 5; |
32 | 32 |
33 Login::Login(Delegate* delegate, | 33 Login::Login(Delegate* delegate, |
34 const buzz::XmppClientSettings& user_settings, | 34 const buzz::XmppClientSettings& user_settings, |
35 const ConnectionOptions& options, | 35 const ConnectionOptions& options, |
36 net::HostResolver* host_resolver, | 36 net::HostResolver* host_resolver, |
| 37 net::CertVerifier* cert_verifier, |
37 ServerInformation* server_list, | 38 ServerInformation* server_list, |
38 int server_count, | 39 int server_count, |
39 bool try_ssltcp_first) | 40 bool try_ssltcp_first) |
40 : delegate_(delegate), | 41 : delegate_(delegate), |
41 login_settings_(new LoginSettings(user_settings, | 42 login_settings_(new LoginSettings(user_settings, |
42 options, | 43 options, |
43 host_resolver, | 44 host_resolver, |
| 45 cert_verifier, |
44 server_list, | 46 server_list, |
45 server_count, | 47 server_count, |
46 try_ssltcp_first)), | 48 try_ssltcp_first)), |
47 redirect_port_(0) { | 49 redirect_port_(0) { |
48 net::NetworkChangeNotifier::AddObserver(this); | 50 net::NetworkChangeNotifier::AddObserver(this); |
49 ResetReconnectState(); | 51 ResetReconnectState(); |
50 } | 52 } |
51 | 53 |
52 Login::~Login() { | 54 Login::~Login() { |
53 net::NetworkChangeNotifier::RemoveObserver(this); | 55 net::NetworkChangeNotifier::RemoveObserver(this); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 const base::TimeDelta kMaxReconnectInterval = | 123 const base::TimeDelta kMaxReconnectInterval = |
122 base::TimeDelta::FromMinutes(30); | 124 base::TimeDelta::FromMinutes(30); |
123 reconnect_interval_ *= 2; | 125 reconnect_interval_ *= 2; |
124 if (reconnect_interval_ > kMaxReconnectInterval) | 126 if (reconnect_interval_ > kMaxReconnectInterval) |
125 reconnect_interval_ = kMaxReconnectInterval; | 127 reconnect_interval_ = kMaxReconnectInterval; |
126 VLOG(1) << "Reconnecting..."; | 128 VLOG(1) << "Reconnecting..."; |
127 StartConnection(); | 129 StartConnection(); |
128 } | 130 } |
129 | 131 |
130 } // namespace notifier | 132 } // namespace notifier |
OLD | NEW |