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