OLD | NEW |
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 "jingle/notifier/communicator/login.h" | 10 #include "jingle/notifier/communicator/login.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // addresses) and maintainence. By containing this within one class, when | 40 // addresses) and maintainence. By containing this within one class, when |
41 // another login attempt is made, this class will be disposed and all of the | 41 // another login attempt is made, this class will be disposed and all of the |
42 // signalling for the previous login attempt will be cleaned up immediately. | 42 // signalling for the previous login attempt will be cleaned up immediately. |
43 // | 43 // |
44 // This is a task to allow for cleaning this up when a signal is being fired. | 44 // This is a task to allow for cleaning this up when a signal is being fired. |
45 // Technically, delete this during the firing of a signal could work but it is | 45 // Technically, delete this during the firing of a signal could work but it is |
46 // fragile. | 46 // fragile. |
47 class SingleLoginAttempt : public talk_base::Task, public sigslot::has_slots<> { | 47 class SingleLoginAttempt : public talk_base::Task, public sigslot::has_slots<> { |
48 public: | 48 public: |
49 SingleLoginAttempt(talk_base::TaskParent* parent, | 49 SingleLoginAttempt(talk_base::TaskParent* parent, |
50 LoginSettings* login_settings, | 50 LoginSettings* login_settings); |
51 bool use_chrome_async_socket, | |
52 bool successful_connection); | |
53 ~SingleLoginAttempt(); | 51 ~SingleLoginAttempt(); |
54 virtual int ProcessStart(); | 52 virtual int ProcessStart(); |
55 void UseNextConnection(); | 53 void UseNextConnection(); |
56 void UseCurrentConnection(); | 54 void UseCurrentConnection(); |
57 | 55 |
58 buzz::XmppClient* xmpp_client() { | 56 buzz::XmppClient* xmpp_client() { |
59 return client_; | 57 return client_; |
60 } | 58 } |
61 | 59 |
62 // Returns the proxy that is being used to connect (or the default proxy | 60 // Returns the proxy that is being used to connect (or the default proxy |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 98 |
101 // Cleans up any xmpp client state to get ready for a new one. | 99 // Cleans up any xmpp client state to get ready for a new one. |
102 void ClearClient(); | 100 void ClearClient(); |
103 | 101 |
104 void HandleConnectionError( | 102 void HandleConnectionError( |
105 buzz::XmppEngine::Error code, | 103 buzz::XmppEngine::Error code, |
106 int subcode, | 104 int subcode, |
107 const buzz::XmlElement* stream_error); | 105 const buzz::XmlElement* stream_error); |
108 void HandleConnectionPasswordError(); | 106 void HandleConnectionPasswordError(); |
109 | 107 |
110 void DiagnoseConnectionError(); | |
111 void OnHttpTestDone(talk_base::SignalThread* thread); | |
112 | |
113 void OnAuthenticationError(); | 108 void OnAuthenticationError(); |
114 void OnCertificateExpired(); | 109 void OnCertificateExpired(); |
115 void OnFreshAuthCookie(const std::string& auth_cookie); | |
116 void OnClientStateChange(buzz::XmppEngine::State state); | 110 void OnClientStateChange(buzz::XmppEngine::State state); |
117 void OnClientStateChangeClosed(buzz::XmppEngine::State previous_state); | 111 void OnClientStateChangeClosed(buzz::XmppEngine::State previous_state); |
118 void OnAttemptedAllConnections(bool successfully_resolved_dns, | 112 void OnAttemptedAllConnections(bool successfully_resolved_dns, |
119 int first_dns_error); | 113 int first_dns_error); |
120 | 114 |
121 bool use_chrome_async_socket_; | |
122 buzz::XmppEngine::State state_; | 115 buzz::XmppEngine::State state_; |
123 buzz::XmppEngine::Error code_; | 116 buzz::XmppEngine::Error code_; |
124 int subcode_; | 117 int subcode_; |
125 bool need_authentication_; | 118 bool need_authentication_; |
126 bool certificate_expired_; | 119 bool certificate_expired_; |
127 bool cookie_refreshed_; | |
128 bool successful_connection_; | |
129 LoginSettings* login_settings_; | 120 LoginSettings* login_settings_; |
130 buzz::XmppClient* client_; | 121 buzz::XmppClient* client_; |
131 scoped_ptr<XmppConnectionGenerator> connection_generator_; | 122 scoped_ptr<XmppConnectionGenerator> connection_generator_; |
132 | 123 |
133 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt); | 124 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt); |
134 }; | 125 }; |
135 | 126 |
136 } // namespace notifier | 127 } // namespace notifier |
137 | 128 |
138 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ | 129 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ |
OLD | NEW |