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 #include <string> | |
6 | |
7 #include "chrome/browser/sync/notifier/communicator/login_settings.h" | |
8 | |
9 #include "chrome/browser/sync/notifier/communicator/connection_options.h" | |
10 #include "chrome/browser/sync/notifier/communicator/xmpp_connection_generator.h" | |
11 #include "talk/base/common.h" | |
12 #include "talk/base/socketaddress.h" | |
13 #include "talk/xmpp/xmppclientsettings.h" | |
14 | |
15 namespace notifier { | |
16 | |
17 LoginSettings::LoginSettings(const buzz::XmppClientSettings& user_settings, | |
18 const ConnectionOptions& options, | |
19 std::string lang, | |
20 ServerInformation* server_list, | |
21 int server_count, | |
22 talk_base::FirewallManager* firewall, | |
23 bool proxy_only) | |
24 : proxy_only_(proxy_only), | |
25 firewall_(firewall), | |
26 lang_(lang), | |
27 server_list_(new ServerInformation[server_count]), | |
28 server_count_(server_count), | |
29 user_settings_(new buzz::XmppClientSettings(user_settings)), | |
30 connection_options_(new ConnectionOptions(options)) { | |
31 // Note: firewall may be NULL. | |
32 ASSERT(server_list != 0); | |
33 ASSERT(server_count > 0); | |
34 for (int i = 0; i < server_count_; ++i) { | |
35 server_list_[i] = server_list[i]; | |
36 } | |
37 } | |
38 | |
39 // Defined so that the destructors are executed here (and the corresponding | |
40 // classes don't need to be included in the header file). | |
41 LoginSettings::~LoginSettings() { | |
42 } | |
43 | |
44 void LoginSettings::set_server_override( | |
45 const talk_base::SocketAddress& server) { | |
46 server_override_.reset(new ServerInformation()); | |
47 server_override_->server = server; | |
48 server_override_->special_port_magic = server_list_[0].special_port_magic; | |
49 } | |
50 | |
51 void LoginSettings::clear_server_override() { | |
52 server_override_.reset(); | |
53 } | |
54 | |
55 } // namespace notifier | |
OLD | NEW |