Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: jingle/notifier/communicator/login.cc

Issue 3358028: Revert r59012 which started using Chrome sockets for sync. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | jingle/notifier/communicator/product_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "jingle/notifier/communicator/login.h" 7 #include "jingle/notifier/communicator/login.h"
8 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/product_info.h"
14 #include "jingle/notifier/communicator/single_login_attempt.h" 15 #include "jingle/notifier/communicator/single_login_attempt.h"
15 #include "net/base/host_port_pair.h" 16 #include "net/base/host_port_pair.h"
16 #include "talk/base/common.h" 17 #include "talk/base/common.h"
17 #include "talk/base/firewallsocketserver.h" 18 #include "talk/base/firewallsocketserver.h"
18 #include "talk/base/logging.h" 19 #include "talk/base/logging.h"
19 #include "talk/base/physicalsocketserver.h" 20 #include "talk/base/physicalsocketserver.h"
20 #include "talk/base/taskrunner.h" 21 #include "talk/base/taskrunner.h"
21 #include "talk/xmllite/xmlelement.h" 22 #include "talk/xmllite/xmlelement.h"
22 #include "talk/xmpp/asyncsocket.h" 23 #include "talk/xmpp/asyncsocket.h"
23 #include "talk/xmpp/prexmppauth.h" 24 #include "talk/xmpp/prexmppauth.h"
24 #include "talk/xmpp/xmppclient.h" 25 #include "talk/xmpp/xmppclient.h"
25 #include "talk/xmpp/xmppclientsettings.h" 26 #include "talk/xmpp/xmppclientsettings.h"
26 #include "talk/xmpp/xmppengine.h" 27 #include "talk/xmpp/xmppengine.h"
27 28
28 namespace notifier { 29 namespace notifier {
29 30
30 // Redirect valid for 5 minutes. 31 // Redirect valid for 5 minutes.
31 static const int kRedirectTimeoutMinutes = 5; 32 static const int kRedirectTimeoutMinutes = 5;
32 33
33 Login::Login(talk_base::TaskParent* parent, 34 Login::Login(talk_base::TaskParent* parent,
35 bool use_chrome_async_socket,
34 const buzz::XmppClientSettings& user_settings, 36 const buzz::XmppClientSettings& user_settings,
35 const ConnectionOptions& options, 37 const ConnectionOptions& options,
36 std::string lang, 38 std::string lang,
37 net::HostResolver* host_resolver, 39 net::HostResolver* host_resolver,
38 ServerInformation* server_list, 40 ServerInformation* server_list,
39 int server_count, 41 int server_count,
40 talk_base::FirewallManager* firewall, 42 talk_base::FirewallManager* firewall,
41 bool try_ssltcp_first, 43 bool try_ssltcp_first,
42 bool proxy_only) 44 bool proxy_only)
43 : parent_(parent), 45 : parent_(parent),
46 use_chrome_async_socket_(use_chrome_async_socket),
44 login_settings_(new LoginSettings(user_settings, 47 login_settings_(new LoginSettings(user_settings,
45 options, 48 options,
46 lang, 49 lang,
47 host_resolver, 50 host_resolver,
48 server_list, 51 server_list,
49 server_count, 52 server_count,
50 firewall, 53 firewall,
51 try_ssltcp_first, 54 try_ssltcp_first,
52 proxy_only)), 55 proxy_only)),
53 state_(STATE_DISCONNECTED), 56 state_(STATE_DISCONNECTED),
(...skipping 19 matching lines...) Expand all
73 login_settings_->set_server_override(server_override); 76 login_settings_->set_server_override(server_override);
74 } else { 77 } else {
75 login_settings_->clear_server_override(); 78 login_settings_->clear_server_override();
76 } 79 }
77 80
78 Disconnect(); 81 Disconnect();
79 82
80 LOG(INFO) << "Starting connection..."; 83 LOG(INFO) << "Starting connection...";
81 84
82 single_attempt_ = new SingleLoginAttempt(parent_, 85 single_attempt_ = new SingleLoginAttempt(parent_,
83 login_settings_.get()); 86 login_settings_.get(),
87 use_chrome_async_socket_,
88 true);
84 89
85 // Do the signaling hook-ups. 90 // Do the signaling hook-ups.
86 single_attempt_->SignalUnexpectedDisconnect.connect( 91 single_attempt_->SignalUnexpectedDisconnect.connect(
87 this, 92 this,
88 &Login::TryReconnect); 93 &Login::TryReconnect);
89 single_attempt_->SignalNeedAutoReconnect.connect( 94 single_attempt_->SignalNeedAutoReconnect.connect(
90 this, 95 this,
91 &Login::TryReconnect); 96 &Login::TryReconnect);
92 single_attempt_->SignalLoginFailure.connect(this, &Login::OnLoginFailure); 97 single_attempt_->SignalLoginFailure.connect(this, &Login::OnLoginFailure);
93 single_attempt_->SignalLogoff.connect( 98 single_attempt_->SignalLogoff.connect(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 base::TimeDelta::FromMinutes(30); 186 base::TimeDelta::FromMinutes(30);
182 reconnect_interval_ *= 2; 187 reconnect_interval_ *= 2;
183 if (reconnect_interval_ > kMaxReconnectInterval) { 188 if (reconnect_interval_ > kMaxReconnectInterval) {
184 reconnect_interval_ = kMaxReconnectInterval; 189 reconnect_interval_ = kMaxReconnectInterval;
185 } 190 }
186 LOG(INFO) << "Reconnecting..."; 191 LOG(INFO) << "Reconnecting...";
187 StartConnection(); 192 StartConnection();
188 } 193 }
189 194
190 } // namespace notifier 195 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | jingle/notifier/communicator/product_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698