| 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); |
| 51 ~SingleLoginAttempt(); | 53 ~SingleLoginAttempt(); |
| 52 virtual int ProcessStart(); | 54 virtual int ProcessStart(); |
| 53 void UseNextConnection(); | 55 void UseNextConnection(); |
| 54 void UseCurrentConnection(); | 56 void UseCurrentConnection(); |
| 55 | 57 |
| 56 buzz::XmppClient* xmpp_client() { | 58 buzz::XmppClient* xmpp_client() { |
| 57 return client_; | 59 return client_; |
| 58 } | 60 } |
| 59 | 61 |
| 60 // Returns the proxy that is being used to connect (or the default proxy | 62 // 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... |
| 98 | 100 |
| 99 // Cleans up any xmpp client state to get ready for a new one. | 101 // Cleans up any xmpp client state to get ready for a new one. |
| 100 void ClearClient(); | 102 void ClearClient(); |
| 101 | 103 |
| 102 void HandleConnectionError( | 104 void HandleConnectionError( |
| 103 buzz::XmppEngine::Error code, | 105 buzz::XmppEngine::Error code, |
| 104 int subcode, | 106 int subcode, |
| 105 const buzz::XmlElement* stream_error); | 107 const buzz::XmlElement* stream_error); |
| 106 void HandleConnectionPasswordError(); | 108 void HandleConnectionPasswordError(); |
| 107 | 109 |
| 110 void DiagnoseConnectionError(); |
| 111 void OnHttpTestDone(talk_base::SignalThread* thread); |
| 112 |
| 108 void OnAuthenticationError(); | 113 void OnAuthenticationError(); |
| 109 void OnCertificateExpired(); | 114 void OnCertificateExpired(); |
| 115 void OnFreshAuthCookie(const std::string& auth_cookie); |
| 110 void OnClientStateChange(buzz::XmppEngine::State state); | 116 void OnClientStateChange(buzz::XmppEngine::State state); |
| 111 void OnClientStateChangeClosed(buzz::XmppEngine::State previous_state); | 117 void OnClientStateChangeClosed(buzz::XmppEngine::State previous_state); |
| 112 void OnAttemptedAllConnections(bool successfully_resolved_dns, | 118 void OnAttemptedAllConnections(bool successfully_resolved_dns, |
| 113 int first_dns_error); | 119 int first_dns_error); |
| 114 | 120 |
| 121 bool use_chrome_async_socket_; |
| 115 buzz::XmppEngine::State state_; | 122 buzz::XmppEngine::State state_; |
| 116 buzz::XmppEngine::Error code_; | 123 buzz::XmppEngine::Error code_; |
| 117 int subcode_; | 124 int subcode_; |
| 118 bool need_authentication_; | 125 bool need_authentication_; |
| 119 bool certificate_expired_; | 126 bool certificate_expired_; |
| 127 bool cookie_refreshed_; |
| 128 bool successful_connection_; |
| 120 LoginSettings* login_settings_; | 129 LoginSettings* login_settings_; |
| 121 buzz::XmppClient* client_; | 130 buzz::XmppClient* client_; |
| 122 scoped_ptr<XmppConnectionGenerator> connection_generator_; | 131 scoped_ptr<XmppConnectionGenerator> connection_generator_; |
| 123 | 132 |
| 124 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt); | 133 DISALLOW_COPY_AND_ASSIGN(SingleLoginAttempt); |
| 125 }; | 134 }; |
| 126 | 135 |
| 127 } // namespace notifier | 136 } // namespace notifier |
| 128 | 137 |
| 129 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ | 138 #endif // JINGLE_NOTIFIER_COMMUNICATOR_SINGLE_LOGIN_ATTEMPT_H_ |
| OLD | NEW |