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

Side by Side Diff: jingle/notifier/communicator/single_login_attempt.h

Issue 4275001: [Sync] Removed more uses of libjingle's sigslot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ 5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_
6 #define JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ 6 #define JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "jingle/notifier/base/xmpp_connection.h" 11 #include "jingle/notifier/base/xmpp_connection.h"
12 #include "jingle/notifier/communicator/xmpp_connection_generator.h" 12 #include "jingle/notifier/communicator/xmpp_connection_generator.h"
13 #include "talk/base/sigslot.h"
14 #include "talk/xmpp/xmppengine.h" 13 #include "talk/xmpp/xmppengine.h"
15 14
16 namespace talk_base { 15 namespace talk_base {
17 class Task; 16 class Task;
18 } 17 }
19 18
20 namespace notifier { 19 namespace notifier {
21 20
22 class ConnectionSettings; 21 class ConnectionSettings;
23 class LoginSettings; 22 class LoginSettings;
24 23
25 // Handles all of the aspects of a single login attempt (across multiple ip 24 // Handles all of the aspects of a single login attempt (across multiple ip
26 // addresses) and maintainence. By containing this within one class, when 25 // addresses) and maintainence. By containing this within one class, when
27 // another login attempt is made, this class will be disposed and all of the 26 // another login attempt is made, this class will be disposed and all of the
28 // signalling for the previous login attempt will be cleaned up immediately. 27 // signalling for the previous login attempt will be cleaned up immediately.
29 class SingleLoginAttempt : public XmppConnection::Delegate, 28 class SingleLoginAttempt : public XmppConnection::Delegate,
30 public XmppConnectionGenerator::Delegate { 29 public XmppConnectionGenerator::Delegate {
31 public: 30 public:
32 explicit SingleLoginAttempt(LoginSettings* login_settings); 31 class Delegate {
32 public:
33 virtual ~Delegate() {}
34
35 virtual void OnConnect(base::WeakPtr<talk_base::Task> base_task) = 0;
36 virtual void OnNeedReconnect() = 0;
37 virtual void OnRedirect(const std::string& redirect_server,
38 int redirect_port) = 0;
39 };
40
41 // Does not take ownership of |login_settings| or |delegate|.
42 // Neither may be NULL.
43 SingleLoginAttempt(LoginSettings* login_settings, Delegate* delegate);
33 44
34 virtual ~SingleLoginAttempt(); 45 virtual ~SingleLoginAttempt();
35 46
36 // XmppConnection::Delegate implementation. 47 // XmppConnection::Delegate implementation.
37 virtual void OnConnect(base::WeakPtr<talk_base::Task> parent); 48 virtual void OnConnect(base::WeakPtr<talk_base::Task> parent);
38 virtual void OnError(buzz::XmppEngine::Error error, 49 virtual void OnError(buzz::XmppEngine::Error error,
39 int error_subcode, 50 int error_subcode,
40 const buzz::XmlElement* stream_error); 51 const buzz::XmlElement* stream_error);
41 52
42 // XmppConnectionGenerator::Delegate implementation. 53 // XmppConnectionGenerator::Delegate implementation.
43 virtual void OnNewSettings(const ConnectionSettings& new_settings); 54 virtual void OnNewSettings(const ConnectionSettings& new_settings);
44 virtual void OnExhaustedSettings(bool successfully_resolved_dns, 55 virtual void OnExhaustedSettings(bool successfully_resolved_dns,
45 int first_dns_error); 56 int first_dns_error);
46 57
47 // Typically handled by storing the redirect for 5 seconds, and setting it
48 // into LoginSettings, then creating a new SingleLoginAttempt, and doing
49 // StartConnection.
50 //
51 // SignalRedirect(const std::string& redirect_server, int redirect_port);
52 sigslot::signal2<const std::string&, int> SignalRedirect;
53
54 sigslot::signal0<> SignalNeedAutoReconnect;
55
56 sigslot::signal1<base::WeakPtr<talk_base::Task> > SignalConnect;
57
58 private: 58 private:
59 LoginSettings* login_settings_; 59 LoginSettings* login_settings_;
60 Delegate* delegate_;
60 XmppConnectionGenerator connection_generator_; 61 XmppConnectionGenerator connection_generator_;
61 scoped_ptr<XmppConnection> xmpp_connection_; 62 scoped_ptr<XmppConnection> xmpp_connection_;
62 63
63 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt); 64 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt);
64 }; 65 };
65 66
66 } // namespace notifier 67 } // namespace notifier
67 68
68 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ 69 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/login.cc ('k') | jingle/notifier/communicator/single_login_attempt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698