| 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_SETTINGS_H_ | 5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
| 6 #define JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ | 6 #define JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "jingle/notifier/communicator/xmpp_connection_generator.h" | 9 #include "jingle/notifier/communicator/xmpp_connection_generator.h" |
| 10 #include "talk/base/scoped_ptr.h" | 10 #include "talk/base/scoped_ptr.h" |
| 11 | 11 |
| 12 namespace buzz { | 12 namespace buzz { |
| 13 class XmppClientSettings; | 13 class XmppClientSettings; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class CertVerifier; |
| 17 class HostPortPair; | 18 class HostPortPair; |
| 18 class HostResolver; | 19 class HostResolver; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace talk_base { | 22 namespace talk_base { |
| 22 class SocketAddress; | 23 class SocketAddress; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace notifier { | 26 namespace notifier { |
| 26 class ConnectionOptions; | 27 class ConnectionOptions; |
| 27 struct ServerInformation; | 28 struct ServerInformation; |
| 28 | 29 |
| 29 class LoginSettings { | 30 class LoginSettings { |
| 30 public: | 31 public: |
| 31 LoginSettings(const buzz::XmppClientSettings& user_settings, | 32 LoginSettings(const buzz::XmppClientSettings& user_settings, |
| 32 const ConnectionOptions& options, | 33 const ConnectionOptions& options, |
| 33 net::HostResolver* host_resolver, | 34 net::HostResolver* host_resolver, |
| 35 net::CertVerifier* cert_verifier, |
| 34 ServerInformation* server_list, | 36 ServerInformation* server_list, |
| 35 int server_count, | 37 int server_count, |
| 36 bool try_ssltcp_first); | 38 bool try_ssltcp_first); |
| 37 | 39 |
| 38 ~LoginSettings(); | 40 ~LoginSettings(); |
| 39 | 41 |
| 40 bool try_ssltcp_first() const { | 42 bool try_ssltcp_first() const { |
| 41 return try_ssltcp_first_; | 43 return try_ssltcp_first_; |
| 42 } | 44 } |
| 43 | 45 |
| 44 net::HostResolver* host_resolver() { | 46 net::HostResolver* host_resolver() { |
| 45 return host_resolver_; | 47 return host_resolver_; |
| 46 } | 48 } |
| 47 | 49 |
| 50 net::CertVerifier* cert_verifier() { |
| 51 return cert_verifier_; |
| 52 } |
| 53 |
| 48 const ServerInformation* server_list() const { | 54 const ServerInformation* server_list() const { |
| 49 return server_override_.get() ? server_override_.get() : server_list_.get(); | 55 return server_override_.get() ? server_override_.get() : server_list_.get(); |
| 50 } | 56 } |
| 51 | 57 |
| 52 int server_count() const { | 58 int server_count() const { |
| 53 return server_override_.get() ? 1 : server_count_; | 59 return server_override_.get() ? 1 : server_count_; |
| 54 } | 60 } |
| 55 | 61 |
| 56 const buzz::XmppClientSettings& user_settings() const { | 62 const buzz::XmppClientSettings& user_settings() const { |
| 57 return *user_settings_.get(); | 63 return *user_settings_.get(); |
| 58 } | 64 } |
| 59 | 65 |
| 60 buzz::XmppClientSettings* modifiable_user_settings() { | 66 buzz::XmppClientSettings* modifiable_user_settings() { |
| 61 return user_settings_.get(); | 67 return user_settings_.get(); |
| 62 } | 68 } |
| 63 | 69 |
| 64 const ConnectionOptions& connection_options() const { | 70 const ConnectionOptions& connection_options() const { |
| 65 return *connection_options_.get(); | 71 return *connection_options_.get(); |
| 66 } | 72 } |
| 67 | 73 |
| 68 void set_server_override(const net::HostPortPair& server); | 74 void set_server_override(const net::HostPortPair& server); |
| 69 void clear_server_override(); | 75 void clear_server_override(); |
| 70 | 76 |
| 71 private: | 77 private: |
| 72 bool try_ssltcp_first_; | 78 bool try_ssltcp_first_; |
| 73 | 79 |
| 74 net::HostResolver* host_resolver_; | 80 net::HostResolver* host_resolver_; |
| 81 net::CertVerifier* cert_verifier_; |
| 75 talk_base::scoped_array<ServerInformation> server_list_; | 82 talk_base::scoped_array<ServerInformation> server_list_; |
| 76 int server_count_; | 83 int server_count_; |
| 77 // Used to handle redirects | 84 // Used to handle redirects |
| 78 scoped_ptr<ServerInformation> server_override_; | 85 scoped_ptr<ServerInformation> server_override_; |
| 79 | 86 |
| 80 scoped_ptr<buzz::XmppClientSettings> user_settings_; | 87 scoped_ptr<buzz::XmppClientSettings> user_settings_; |
| 81 scoped_ptr<ConnectionOptions> connection_options_; | 88 scoped_ptr<ConnectionOptions> connection_options_; |
| 82 DISALLOW_COPY_AND_ASSIGN(LoginSettings); | 89 DISALLOW_COPY_AND_ASSIGN(LoginSettings); |
| 83 }; | 90 }; |
| 84 } // namespace notifier | 91 } // namespace notifier |
| 85 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ | 92 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
| OLD | NEW |