OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
| 7 #include <string> |
| 8 |
| 9 #include "chrome/browser/sync/notifier/communicator/xmpp_connection_generator.h" |
| 10 #include "talk/base/scoped_ptr.h" |
| 11 |
| 12 namespace buzz { |
| 13 class XmppClientSettings; |
| 14 } |
| 15 |
| 16 namespace talk_base { |
| 17 class FirewallManager; |
| 18 class SocketAddress; |
| 19 } |
| 20 |
| 21 namespace notifier { |
| 22 class ConnectionOptions; |
| 23 struct ServerInformation; |
| 24 |
| 25 class LoginSettings { |
| 26 public: |
| 27 LoginSettings(const buzz::XmppClientSettings& user_settings, |
| 28 const ConnectionOptions& options, |
| 29 std::string lang, |
| 30 ServerInformation* server_list, |
| 31 int server_count, |
| 32 talk_base::FirewallManager* firewall, |
| 33 bool no_gaia_auth, |
| 34 bool proxy_only); |
| 35 |
| 36 ~LoginSettings(); |
| 37 |
| 38 // Note: firewall() may return NULL. |
| 39 // |
| 40 // Could be a const method, but it allows |
| 41 // modification of part (FirewallManager) of its state. |
| 42 talk_base::FirewallManager* firewall() { |
| 43 return firewall_; |
| 44 } |
| 45 |
| 46 bool no_gaia_auth() const { |
| 47 return no_gaia_auth_; |
| 48 } |
| 49 |
| 50 bool proxy_only() const { |
| 51 return proxy_only_; |
| 52 } |
| 53 |
| 54 const std::string& lang() const { |
| 55 return lang_; |
| 56 } |
| 57 |
| 58 const ServerInformation* server_list() const { |
| 59 return server_override_.get() ? server_override_.get() : server_list_.get(); |
| 60 } |
| 61 |
| 62 int server_count() const { |
| 63 return server_override_.get() ? 1 : server_count_; |
| 64 } |
| 65 |
| 66 const buzz::XmppClientSettings& user_settings() const { |
| 67 return *user_settings_.get(); |
| 68 } |
| 69 |
| 70 buzz::XmppClientSettings* modifiable_user_settings() { |
| 71 return user_settings_.get(); |
| 72 } |
| 73 |
| 74 const ConnectionOptions& connection_options() const { |
| 75 return *connection_options_.get(); |
| 76 } |
| 77 |
| 78 void set_server_override(const talk_base::SocketAddress& server); |
| 79 void clear_server_override(); |
| 80 |
| 81 private: |
| 82 bool proxy_only_; |
| 83 bool no_gaia_auth_; |
| 84 talk_base::FirewallManager* firewall_; |
| 85 std::string lang_; |
| 86 |
| 87 talk_base::scoped_array<ServerInformation> server_list_; |
| 88 int server_count_; |
| 89 // Used to handle redirects |
| 90 scoped_ptr<ServerInformation> server_override_; |
| 91 |
| 92 scoped_ptr<buzz::XmppClientSettings> user_settings_; |
| 93 scoped_ptr<ConnectionOptions> connection_options_; |
| 94 DISALLOW_COPY_AND_ASSIGN(LoginSettings); |
| 95 }; |
| 96 } // namespace notifier |
| 97 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ |
OLD | NEW |