OLD | NEW |
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 #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/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 class LoginSettings; | 37 class LoginSettings; |
38 struct ServerInformation; | 38 struct ServerInformation; |
39 | 39 |
40 // Workaround for MSVS 2005 bug that fails to handle inheritance from a nested | 40 // Workaround for MSVS 2005 bug that fails to handle inheritance from a nested |
41 // class properly if it comes directly on a base class list. | 41 // class properly if it comes directly on a base class list. |
42 typedef SingleLoginAttempt::Delegate SingleLoginAttemptDelegate; | 42 typedef SingleLoginAttempt::Delegate SingleLoginAttemptDelegate; |
43 | 43 |
44 // Does the login, keeps it alive (with refreshing cookies and reattempting | 44 // Does the login, keeps it alive (with refreshing cookies and reattempting |
45 // login when disconnected), figures out what actions to take on the various | 45 // login when disconnected), figures out what actions to take on the various |
46 // errors that may occur. | 46 // errors that may occur. |
47 class Login : public net::NetworkChangeNotifier::Observer, | 47 class Login : public net::NetworkChangeNotifier::IPAddressObserver, |
48 public SingleLoginAttemptDelegate { | 48 public SingleLoginAttemptDelegate { |
49 public: | 49 public: |
50 class Delegate { | 50 class Delegate { |
51 public: | 51 public: |
52 virtual ~Delegate() {} | 52 virtual ~Delegate() {} |
53 | 53 |
54 virtual void OnConnect(base::WeakPtr<talk_base::Task> base_task) = 0; | 54 virtual void OnConnect(base::WeakPtr<talk_base::Task> base_task) = 0; |
55 virtual void OnDisconnect() = 0; | 55 virtual void OnDisconnect() = 0; |
56 }; | 56 }; |
57 | 57 |
58 // Does not take ownership of |delegate|, |host_resolver|, |cert_verifier|, | 58 // Does not take ownership of |delegate|, |host_resolver|, |cert_verifier|, |
59 // or |server_list|, none of which may be NULL. | 59 // or |server_list|, none of which may be NULL. |
60 Login(Delegate* delegate, | 60 Login(Delegate* delegate, |
61 const buzz::XmppClientSettings& user_settings, | 61 const buzz::XmppClientSettings& user_settings, |
62 const ConnectionOptions& options, | 62 const ConnectionOptions& options, |
63 net::HostResolver* host_resolver, | 63 net::HostResolver* host_resolver, |
64 net::CertVerifier* cert_verifier, | 64 net::CertVerifier* cert_verifier, |
65 ServerInformation* server_list, | 65 ServerInformation* server_list, |
66 int server_count, | 66 int server_count, |
67 bool try_ssltcp_first); | 67 bool try_ssltcp_first); |
68 virtual ~Login(); | 68 virtual ~Login(); |
69 | 69 |
70 void StartConnection(); | 70 void StartConnection(); |
71 | 71 |
72 // net::NetworkChangeNotifier::Observer implementation. | 72 // net::NetworkChangeNotifier::IPAddressObserver implementation. |
73 virtual void OnIPAddressChanged(); | 73 virtual void OnIPAddressChanged(); |
74 | 74 |
75 // SingleLoginAttempt::Delegate implementation. | 75 // SingleLoginAttempt::Delegate implementation. |
76 virtual void OnConnect(base::WeakPtr<talk_base::Task> base_task); | 76 virtual void OnConnect(base::WeakPtr<talk_base::Task> base_task); |
77 virtual void OnNeedReconnect(); | 77 virtual void OnNeedReconnect(); |
78 virtual void OnRedirect(const std::string& redirect_server, | 78 virtual void OnRedirect(const std::string& redirect_server, |
79 int redirect_port); | 79 int redirect_port); |
80 | 80 |
81 private: | 81 private: |
82 void OnLogoff(); | 82 void OnLogoff(); |
(...skipping 22 matching lines...) Expand all Loading... |
105 base::Time redirect_time_; | 105 base::Time redirect_time_; |
106 std::string redirect_server_; | 106 std::string redirect_server_; |
107 int redirect_port_; | 107 int redirect_port_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(Login); | 109 DISALLOW_COPY_AND_ASSIGN(Login); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace notifier | 112 } // namespace notifier |
113 | 113 |
114 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ | 114 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_H_ |
OLD | NEW |