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

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

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

Powered by Google App Engine
This is Rietveld 408576698