| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOGIN_H_ | 5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ |
| 6 #define JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ | 6 #define JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace notifier { | 32 namespace notifier { |
| 33 | 33 |
| 34 class LoginSettings; | 34 class LoginSettings; |
| 35 | 35 |
| 36 // Does the login, keeps it alive (with refreshing cookies and | 36 // Does the login, keeps it alive (with refreshing cookies and |
| 37 // reattempting login when disconnected), and figures out what actions | 37 // reattempting login when disconnected), and figures out what actions |
| 38 // to take on the various errors that may occur. | 38 // to take on the various errors that may occur. |
| 39 // | 39 // |
| 40 // TODO(akalin): Make this observe proxy config changes also. | 40 // TODO(akalin): Make this observe proxy config changes also. |
| 41 class Login : public net::NetworkChangeNotifier::IPAddressObserver, | 41 class Login : public net::NetworkChangeNotifier::NetworkChangeObserver, |
| 42 public net::NetworkChangeNotifier::ConnectionTypeObserver, | |
| 43 public net::NetworkChangeNotifier::DNSObserver, | 42 public net::NetworkChangeNotifier::DNSObserver, |
| 44 public SingleLoginAttempt::Delegate { | 43 public SingleLoginAttempt::Delegate { |
| 45 public: | 44 public: |
| 46 class Delegate { | 45 class Delegate { |
| 47 public: | 46 public: |
| 48 // Called when a connection has been successfully established. | 47 // Called when a connection has been successfully established. |
| 49 virtual void OnConnect( | 48 virtual void OnConnect( |
| 50 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) = 0; | 49 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) = 0; |
| 51 | 50 |
| 52 // Called when there's no connection to the server but we expect | 51 // Called when there's no connection to the server but we expect |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 virtual ~Login(); | 74 virtual ~Login(); |
| 76 | 75 |
| 77 // Starts connecting (or forces a reconnection if we're backed off). | 76 // Starts connecting (or forces a reconnection if we're backed off). |
| 78 void StartConnection(); | 77 void StartConnection(); |
| 79 | 78 |
| 80 // The updated settings take effect only the next time when a | 79 // The updated settings take effect only the next time when a |
| 81 // connection is attempted (either via reconnection or a call to | 80 // connection is attempted (either via reconnection or a call to |
| 82 // StartConnection()). | 81 // StartConnection()). |
| 83 void UpdateXmppSettings(const buzz::XmppClientSettings& user_settings); | 82 void UpdateXmppSettings(const buzz::XmppClientSettings& user_settings); |
| 84 | 83 |
| 85 // net::NetworkChangeNotifier::IPAddressObserver implementation. | 84 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. |
| 86 virtual void OnIPAddressChanged() OVERRIDE; | 85 virtual void OnNetworkChanged( |
| 87 | |
| 88 // net::NetworkChangeNotifier::ConnectionTypeObserver implementation. | |
| 89 virtual void OnConnectionTypeChanged( | |
| 90 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 86 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| 91 | 87 |
| 92 // net::NetworkChangeNotifier::DNSObserver implementation. | 88 // net::NetworkChangeNotifier::DNSObserver implementation. |
| 93 virtual void OnDNSChanged() OVERRIDE; | 89 virtual void OnDNSChanged() OVERRIDE; |
| 94 | 90 |
| 95 // SingleLoginAttempt::Delegate implementation. | 91 // SingleLoginAttempt::Delegate implementation. |
| 96 virtual void OnConnect( | 92 virtual void OnConnect( |
| 97 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE; | 93 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE; |
| 98 virtual void OnRedirect(const ServerInformation& redirect_server) OVERRIDE; | 94 virtual void OnRedirect(const ServerInformation& redirect_server) OVERRIDE; |
| 99 virtual void OnCredentialsRejected() OVERRIDE; | 95 virtual void OnCredentialsRejected() OVERRIDE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 122 // reconnection state. | 118 // reconnection state. |
| 123 base::TimeDelta reconnect_interval_; | 119 base::TimeDelta reconnect_interval_; |
| 124 base::OneShotTimer<Login> reconnect_timer_; | 120 base::OneShotTimer<Login> reconnect_timer_; |
| 125 | 121 |
| 126 DISALLOW_COPY_AND_ASSIGN(Login); | 122 DISALLOW_COPY_AND_ASSIGN(Login); |
| 127 }; | 123 }; |
| 128 | 124 |
| 129 } // namespace notifier | 125 } // namespace notifier |
| 130 | 126 |
| 131 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ | 127 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ |
| OLD | NEW |