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 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
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 14 matching lines...) Expand all
25 // SignalingConnector listens for SignalStrategy status notifications 25 // SignalingConnector listens for SignalStrategy status notifications
26 // and attempts to keep it connected when possible. When signalling is 26 // and attempts to keep it connected when possible. When signalling is
27 // not connected it keeps trying to reconnect it until it is 27 // not connected it keeps trying to reconnect it until it is
28 // connected. It limits connection attempt rate using exponential 28 // connected. It limits connection attempt rate using exponential
29 // backoff. It also monitors network state and reconnects signalling 29 // backoff. It also monitors network state and reconnects signalling
30 // whenever connection type changes or IP address changes. 30 // whenever connection type changes or IP address changes.
31 class SignalingConnector 31 class SignalingConnector
32 : public base::SupportsWeakPtr<SignalingConnector>, 32 : public base::SupportsWeakPtr<SignalingConnector>,
33 public base::NonThreadSafe, 33 public base::NonThreadSafe,
34 public SignalStrategy::Listener, 34 public SignalStrategy::Listener,
35 public net::NetworkChangeNotifier::ConnectionTypeObserver, 35 public net::NetworkChangeNotifier::NetworkChangeObserver,
36 public net::NetworkChangeNotifier::IPAddressObserver,
37 public gaia::GaiaOAuthClient::Delegate { 36 public gaia::GaiaOAuthClient::Delegate {
38 public: 37 public:
39 // This structure contains information required to perform 38 // This structure contains information required to perform
40 // authentication to OAuth2. 39 // authentication to OAuth2.
41 struct OAuthCredentials { 40 struct OAuthCredentials {
42 OAuthCredentials(const std::string& login_value, 41 OAuthCredentials(const std::string& login_value,
43 const std::string& refresh_token_value); 42 const std::string& refresh_token_value);
44 43
45 // The user's account name (i.e. their email address). 44 // The user's account name (i.e. their email address).
46 std::string login; 45 std::string login;
(...skipping 13 matching lines...) Expand all
60 // May be called immediately after the constructor to enable OAuth 59 // May be called immediately after the constructor to enable OAuth
61 // access token updating. 60 // access token updating.
62 void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials); 61 void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials);
63 62
64 // SignalStrategy::Listener interface. 63 // SignalStrategy::Listener interface.
65 virtual void OnSignalStrategyStateChange( 64 virtual void OnSignalStrategyStateChange(
66 SignalStrategy::State state) OVERRIDE; 65 SignalStrategy::State state) OVERRIDE;
67 virtual bool OnSignalStrategyIncomingStanza( 66 virtual bool OnSignalStrategyIncomingStanza(
68 const buzz::XmlElement* stanza) OVERRIDE; 67 const buzz::XmlElement* stanza) OVERRIDE;
69 68
70 // NetworkChangeNotifier::ConnectionTypeObserver interface. 69 // NetworkChangeNotifier::NetworkChangeObserver interface.
71 virtual void OnConnectionTypeChanged( 70 virtual void OnNetworkChanged(
72 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 71 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
73 72
74 // NetworkChangeNotifier::IPAddressObserver interface.
75 virtual void OnIPAddressChanged() OVERRIDE;
76
77 // gaia::GaiaOAuthClient::Delegate interface. 73 // gaia::GaiaOAuthClient::Delegate interface.
78 virtual void OnGetTokensResponse(const std::string& user_email, 74 virtual void OnGetTokensResponse(const std::string& user_email,
79 const std::string& access_token, 75 const std::string& access_token,
80 int expires_seconds) OVERRIDE; 76 int expires_seconds) OVERRIDE;
81 virtual void OnRefreshTokenResponse(const std::string& access_token, 77 virtual void OnRefreshTokenResponse(const std::string& access_token,
82 int expires_in_seconds) OVERRIDE; 78 int expires_in_seconds) OVERRIDE;
83 virtual void OnGetUserInfoResponse(const std::string& user_email) OVERRIDE; 79 virtual void OnGetUserInfoResponse(const std::string& user_email) OVERRIDE;
84 virtual void OnOAuthError() OVERRIDE; 80 virtual void OnOAuthError() OVERRIDE;
85 virtual void OnNetworkError(int response_code) OVERRIDE; 81 virtual void OnNetworkError(int response_code) OVERRIDE;
86 82
(...skipping 21 matching lines...) Expand all
108 base::Time auth_token_expiry_time_; 104 base::Time auth_token_expiry_time_;
109 105
110 base::OneShotTimer<SignalingConnector> timer_; 106 base::OneShotTimer<SignalingConnector> timer_;
111 107
112 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); 108 DISALLOW_COPY_AND_ASSIGN(SignalingConnector);
113 }; 109 };
114 110
115 } // namespace remoting 111 } // namespace remoting
116 112
117 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ 113 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698