Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/sync/notifier/communicator/xmpp_connection_generator.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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_XMPP_CONNECTION_GENERATOR_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_XMPP_CONNECTION_GENERATOR_H_
7 #include <vector>
8
9 #include "talk/base/scoped_ptr.h"
10 #include "talk/base/sigslot.h"
11 #include "talk/base/socketaddress.h"
12
13 namespace talk_base {
14 class AutoDetectProxy;
15 struct ProxyInfo;
16 class SignalThread;
17 class Task;
18 }
19
20 namespace notifier {
21 class AsyncDNSLookup;
22 class ConnectionOptions;
23 class ConnectionSettings;
24 class ConnectionSettingsList;
25
26 struct ServerInformation {
27 talk_base::SocketAddress server;
28 bool special_port_magic;
29 };
30
31 // Resolves dns names and iterates through the various ip address
32 // and transport combinations.
33 class XmppConnectionGenerator : public sigslot::has_slots<> {
34 public:
35 // parent is the parent for any tasks needed during this operation
36 // proxy_only indicates if true connections are only attempted using the proxy
37 // server_list is the list of connections to attempt in priority order
38 // server_count is the number of items in the server list
39 XmppConnectionGenerator(talk_base::Task* parent,
40 const ConnectionOptions* options,
41 bool proxy_only,
42 const ServerInformation* server_list,
43 int server_count);
44 ~XmppConnectionGenerator();
45
46 // Only call this once. Create a new XmppConnectionGenerator and
47 // delete the current one if the process needs to start again.
48 void StartGenerating();
49
50 void UseNextConnection();
51 void UseCurrentConnection();
52
53 const talk_base::ProxyInfo& proxy() const;
54
55 sigslot::signal1<const ConnectionSettings&> SignalNewSettings;
56
57 // SignalExhaustedSettings(bool successfully_resolved_dns,
58 // int first_dns_error);
59 sigslot::signal2<bool, int> SignalExhaustedSettings;
60
61 private:
62 void OnProxyDetect(talk_base::AutoDetectProxy* proxy_detect);
63 void OnServerDNSResolved(AsyncDNSLookup* dns_lookup);
64 void HandleExhaustedConnections();
65
66 talk_base::scoped_ptr<ConnectionSettingsList> settings_list_;
67 int settings_index_; // the setting that is currently being used
68 talk_base::scoped_array<ServerInformation> server_list_;
69 int server_count_;
70 int server_index_; // the server that is current being used
71 bool proxy_only_;
72 bool successfully_resolved_dns_;
73 int first_dns_error_;
74 const ConnectionOptions* options_;
75
76 talk_base::Task* parent_;
77 DISALLOW_COPY_AND_ASSIGN(XmppConnectionGenerator);
78 };
79 } // namespace notifier
80
81 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_XMPP_CONNECTION_GENERATOR_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698