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

Side by Side Diff: remoting/host/signaling_connector.h

Issue 1123163002: Updated remoting host to create instances of GCD-related classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-xmpp-connect2c
Patch Set: Moved ownership of GcdRestClient to GcdStateUpdater Created 5 years, 6 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
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/signaling_connector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_HOST_SIGNALING_CONNECTOR_H_ 5 #ifndef REMOTING_HOST_SIGNALING_CONNECTOR_H_
6 #define REMOTING_HOST_SIGNALING_CONNECTOR_H_ 6 #define REMOTING_HOST_SIGNALING_CONNECTOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
(...skipping 13 matching lines...) Expand all
24 // backoff. It also monitors network state and reconnects signalling 24 // backoff. It also monitors network state and reconnects signalling
25 // whenever connection type changes or IP address changes. 25 // whenever connection type changes or IP address changes.
26 class SignalingConnector 26 class SignalingConnector
27 : public base::SupportsWeakPtr<SignalingConnector>, 27 : public base::SupportsWeakPtr<SignalingConnector>,
28 public base::NonThreadSafe, 28 public base::NonThreadSafe,
29 public SignalStrategy::Listener, 29 public SignalStrategy::Listener,
30 public net::NetworkChangeNotifier::ConnectionTypeObserver, 30 public net::NetworkChangeNotifier::ConnectionTypeObserver,
31 public net::NetworkChangeNotifier::IPAddressObserver { 31 public net::NetworkChangeNotifier::IPAddressObserver {
32 public: 32 public:
33 // The |auth_failed_callback| is called when authentication fails. 33 // The |auth_failed_callback| is called when authentication fails.
34 SignalingConnector( 34 SignalingConnector(XmppSignalStrategy* signal_strategy,
35 XmppSignalStrategy* signal_strategy, 35 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker,
36 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker, 36 OAuthTokenGetter* oauth_token_getter,
37 scoped_ptr<OAuthTokenGetter> oauth_token_getter, 37 const base::Closure& auth_failed_callback);
38 const base::Closure& auth_failed_callback);
39 ~SignalingConnector() override; 38 ~SignalingConnector() override;
40 39
41 // OAuthTokenGetter callback. 40 // OAuthTokenGetter callback.
42 void OnAccessToken(OAuthTokenGetter::Status status, 41 void OnAccessToken(OAuthTokenGetter::Status status,
43 const std::string& user_email, 42 const std::string& user_email,
44 const std::string& access_token); 43 const std::string& access_token);
45 44
46 // SignalStrategy::Listener interface. 45 // SignalStrategy::Listener interface.
47 void OnSignalStrategyStateChange(SignalStrategy::State state) override; 46 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
48 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; 47 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
49 48
50 // NetworkChangeNotifier::ConnectionTypeObserver interface. 49 // NetworkChangeNotifier::ConnectionTypeObserver interface.
51 void OnConnectionTypeChanged( 50 void OnConnectionTypeChanged(
52 net::NetworkChangeNotifier::ConnectionType type) override; 51 net::NetworkChangeNotifier::ConnectionType type) override;
53 52
54 // NetworkChangeNotifier::IPAddressObserver interface. 53 // NetworkChangeNotifier::IPAddressObserver interface.
55 void OnIPAddressChanged() override; 54 void OnIPAddressChanged() override;
56 55
57 private: 56 private:
58 void OnNetworkError(); 57 void OnNetworkError();
59 void ScheduleTryReconnect(); 58 void ScheduleTryReconnect();
60 void ResetAndTryReconnect(); 59 void ResetAndTryReconnect();
61 void TryReconnect(); 60 void TryReconnect();
62 void OnDnsBlackholeCheckerDone(bool allow); 61 void OnDnsBlackholeCheckerDone(bool allow);
63 62
64 XmppSignalStrategy* signal_strategy_; 63 XmppSignalStrategy* signal_strategy_;
65 base::Closure auth_failed_callback_; 64 base::Closure auth_failed_callback_;
66 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; 65 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_;
67 66
68 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; 67 OAuthTokenGetter* oauth_token_getter_;
69 68
70 // Number of times we tried to connect without success. 69 // Number of times we tried to connect without success.
71 int reconnect_attempts_; 70 int reconnect_attempts_;
72 71
73 base::OneShotTimer<SignalingConnector> timer_; 72 base::OneShotTimer<SignalingConnector> timer_;
74 73
75 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); 74 DISALLOW_COPY_AND_ASSIGN(SignalingConnector);
76 }; 75 };
77 76
78 } // namespace remoting 77 } // namespace remoting
79 78
80 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ 79 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/signaling_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698