Chromium Code Reviews| Index: remoting/host/signaling_connector.h |
| diff --git a/remoting/host/signaling_connector.h b/remoting/host/signaling_connector.h |
| index f1466b7aa0406142bb7e8634ca984559d9e18e4d..520f7278003a479e92cf72ca4cc075f338b70a75 100644 |
| --- a/remoting/host/signaling_connector.h |
| +++ b/remoting/host/signaling_connector.h |
| @@ -10,15 +10,19 @@ |
| #include "base/threading/non_thread_safe.h" |
| #include "base/timer.h" |
| #include "net/base/network_change_notifier.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| #include "remoting/host/gaia_oauth_client.h" |
| #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
| namespace net { |
| +class URLFetcher; |
| class URLRequestContextGetter; |
| } // namespace net |
| namespace remoting { |
| +class ChromotingHostContext; |
| + |
| // SignalingConnector listens for SignalStrategy status notifications |
| // and attempts to keep it connected when possible. When signalling is |
| // not connected it keeps trying to reconnect it until it is |
| @@ -29,6 +33,7 @@ class SignalingConnector |
| : public base::SupportsWeakPtr<SignalingConnector>, |
| public base::NonThreadSafe, |
| public SignalStrategy::Listener, |
| + public net::URLFetcherDelegate, |
|
Sergey Ulanov
2012/08/24 19:43:33
Can you please move the new connectivity checking
garykac
2012/08/27 22:34:57
Done.
|
| public net::NetworkChangeNotifier::ConnectionTypeObserver, |
| public net::NetworkChangeNotifier::IPAddressObserver, |
| public GaiaOAuthClient::Delegate { |
| @@ -52,13 +57,14 @@ class SignalingConnector |
| // The |auth_failed_callback| is called when authentication fails. |
| SignalingConnector(XmppSignalStrategy* signal_strategy, |
| + ChromotingHostContext* context, |
| + std::string talkgadget_prefix, |
| const base::Closure& auth_failed_callback); |
| virtual ~SignalingConnector(); |
| // May be called immediately after the constructor to enable OAuth |
| // access token updating. |
| - void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials, |
| - net::URLRequestContextGetter* url_context); |
| + void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials); |
| // SignalStrategy::Listener interface. |
| virtual void OnSignalStrategyStateChange( |
| @@ -66,13 +72,16 @@ class SignalingConnector |
| virtual bool OnSignalStrategyIncomingStanza( |
| const buzz::XmlElement* stanza) OVERRIDE; |
| - // NetworkChangeNotifier::IPAddressObserver interface. |
| - virtual void OnIPAddressChanged() OVERRIDE; |
| + // net::URLFetcherDelegate interface. |
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| // NetworkChangeNotifier::ConnectionTypeObserver interface. |
| virtual void OnConnectionTypeChanged( |
| net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| + // NetworkChangeNotifier::IPAddressObserver interface. |
| + virtual void OnIPAddressChanged() OVERRIDE; |
| + |
| // GaiaOAuthClient::Delegate interface. |
| virtual void OnRefreshTokenResponse(const std::string& user_email, |
| const std::string& access_token, |
| @@ -88,11 +97,22 @@ class SignalingConnector |
| void RefreshOAuthToken(); |
| XmppSignalStrategy* signal_strategy_; |
| + ChromotingHostContext* context_; |
| base::Closure auth_failed_callback_; |
| scoped_ptr<OAuthCredentials> oauth_credentials_; |
| scoped_ptr<GaiaOAuthClient> gaia_oauth_client_; |
| + // URL fetcher used to verify access to the host talkgadget. |
| + scoped_ptr<net::URLFetcher> url_fetcher_; |
| + |
| + // The string pre-pended to '.talkgadget.google.com' to create the full |
| + // talkgadget domain name for the host. |
| + std::string talkgadget_prefix_; |
| + |
| + // Did we make a successful connection to the host talkgadget? |
| + bool found_talkgadget_; |
| + |
| // Number of times we tried to connect without success. |
| int reconnect_attempts_; |