| OLD | NEW | 
|   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 21 matching lines...) Expand all  Loading... | 
|  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( | 
|  35       XmppSignalStrategy* signal_strategy, |  35       XmppSignalStrategy* signal_strategy, | 
|  36       scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker, |  36       scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker, | 
|  37       const base::Closure& auth_failed_callback); |  37       const base::Closure& auth_failed_callback); | 
|  38   ~SignalingConnector() override; |  38   ~SignalingConnector() override; | 
|  39  |  39  | 
|  40   // May be called immediately after the constructor to enable OAuth |  40   // May be called immediately after the constructor to enable OAuth | 
|  41   // access token updating. |  41   // access token updating. | 
|  42   // |oauth_token_getter| must outlive SignalingConnector. |  42   void EnableOAuth(scoped_ptr<OAuthTokenGetter> oauth_token_getter); | 
|  43   void EnableOAuth(OAuthTokenGetter* oauth_token_getter); |  | 
|  44  |  43  | 
|  45   // OAuthTokenGetter callback. |  44   // OAuthTokenGetter callback. | 
|  46   void OnAccessToken(OAuthTokenGetter::Status status, |  45   void OnAccessToken(OAuthTokenGetter::Status status, | 
|  47                      const std::string& user_email, |  46                      const std::string& user_email, | 
|  48                      const std::string& access_token); |  47                      const std::string& access_token); | 
|  49  |  48  | 
|  50   // SignalStrategy::Listener interface. |  49   // SignalStrategy::Listener interface. | 
|  51   void OnSignalStrategyStateChange(SignalStrategy::State state) override; |  50   void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 
|  52   bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |  51   bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 
|  53  |  52  | 
|  54   // NetworkChangeNotifier::ConnectionTypeObserver interface. |  53   // NetworkChangeNotifier::ConnectionTypeObserver interface. | 
|  55   void OnConnectionTypeChanged( |  54   void OnConnectionTypeChanged( | 
|  56       net::NetworkChangeNotifier::ConnectionType type) override; |  55       net::NetworkChangeNotifier::ConnectionType type) override; | 
|  57  |  56  | 
|  58   // NetworkChangeNotifier::IPAddressObserver interface. |  57   // NetworkChangeNotifier::IPAddressObserver interface. | 
|  59   void OnIPAddressChanged() override; |  58   void OnIPAddressChanged() override; | 
|  60  |  59  | 
|  61  private: |  60  private: | 
|  62   void OnNetworkError(); |  61   void OnNetworkError(); | 
|  63   void ScheduleTryReconnect(); |  62   void ScheduleTryReconnect(); | 
|  64   void ResetAndTryReconnect(); |  63   void ResetAndTryReconnect(); | 
|  65   void TryReconnect(); |  64   void TryReconnect(); | 
|  66   void OnDnsBlackholeCheckerDone(bool allow); |  65   void OnDnsBlackholeCheckerDone(bool allow); | 
|  67  |  66  | 
|  68   XmppSignalStrategy* signal_strategy_; |  67   XmppSignalStrategy* signal_strategy_; | 
|  69   base::Closure auth_failed_callback_; |  68   base::Closure auth_failed_callback_; | 
|  70   scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; |  69   scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; | 
|  71  |  70  | 
|  72   OAuthTokenGetter* oauth_token_getter_; |  71   scoped_ptr<OAuthTokenGetter> oauth_token_getter_; | 
|  73  |  72  | 
|  74   // Number of times we tried to connect without success. |  73   // Number of times we tried to connect without success. | 
|  75   int reconnect_attempts_; |  74   int reconnect_attempts_; | 
|  76  |  75  | 
|  77   base::OneShotTimer<SignalingConnector> timer_; |  76   base::OneShotTimer<SignalingConnector> timer_; | 
|  78  |  77  | 
|  79   DISALLOW_COPY_AND_ASSIGN(SignalingConnector); |  78   DISALLOW_COPY_AND_ASSIGN(SignalingConnector); | 
|  80 }; |  79 }; | 
|  81  |  80  | 
|  82 }  // namespace remoting |  81 }  // namespace remoting | 
|  83  |  82  | 
|  84 #endif  // REMOTING_HOST_SIGNALING_CONNECTOR_H_ |  83 #endif  // REMOTING_HOST_SIGNALING_CONNECTOR_H_ | 
| OLD | NEW |