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 proxy_only); | |
34 | |
35 ~LoginSettings(); | |
36 | |
37 // Note: firewall() may return NULL. | |
38 // | |
39 // Could be a const method, but it allows | |
40 // modification of part (FirewallManager) of its state. | |
41 talk_base::FirewallManager* firewall() { | |
42 return firewall_; | |
43 } | |
44 | |
45 bool proxy_only() const { | |
46 return proxy_only_; | |
47 } | |
48 | |
49 const std::string& lang() const { | |
50 return lang_; | |
51 } | |
52 | |
53 const ServerInformation* server_list() const { | |
54 return server_override_.get() ? server_override_.get() : server_list_.get(); | |
55 } | |
56 | |
57 int server_count() const { | |
58 return server_override_.get() ? 1 : server_count_; | |
59 } | |
60 | |
61 const buzz::XmppClientSettings& user_settings() const { | |
62 return *user_settings_.get(); | |
63 } | |
64 | |
65 buzz::XmppClientSettings* modifiable_user_settings() { | |
66 return user_settings_.get(); | |
67 } | |
68 | |
69 const ConnectionOptions& connection_options() const { | |
70 return *connection_options_.get(); | |
71 } | |
72 | |
73 void set_server_override(const talk_base::SocketAddress& server); | |
74 void clear_server_override(); | |
75 | |
76 private: | |
77 bool proxy_only_; | |
78 talk_base::FirewallManager* firewall_; | |
79 std::string lang_; | |
80 | |
81 talk_base::scoped_array<ServerInformation> server_list_; | |
82 int server_count_; | |
83 // Used to handle redirects | |
84 scoped_ptr<ServerInformation> server_override_; | |
85 | |
86 scoped_ptr<buzz::XmppClientSettings> user_settings_; | |
87 scoped_ptr<ConnectionOptions> connection_options_; | |
88 DISALLOW_COPY_AND_ASSIGN(LoginSettings); | |
89 }; | |
90 } // namespace notifier | |
91 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_ | |
OLD | NEW |