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 virtual ~SignalingConnector(); | 38 virtual ~SignalingConnector(); |
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 virtual void OnSignalStrategyStateChange( | 50 virtual void OnSignalStrategyStateChange( |
52 SignalStrategy::State state) override; | 51 SignalStrategy::State state) override; |
53 virtual bool OnSignalStrategyIncomingStanza( | 52 virtual bool OnSignalStrategyIncomingStanza( |
(...skipping 10 matching lines...) Expand all Loading... |
64 void OnNetworkError(); | 63 void OnNetworkError(); |
65 void ScheduleTryReconnect(); | 64 void ScheduleTryReconnect(); |
66 void ResetAndTryReconnect(); | 65 void ResetAndTryReconnect(); |
67 void TryReconnect(); | 66 void TryReconnect(); |
68 void OnDnsBlackholeCheckerDone(bool allow); | 67 void OnDnsBlackholeCheckerDone(bool allow); |
69 | 68 |
70 XmppSignalStrategy* signal_strategy_; | 69 XmppSignalStrategy* signal_strategy_; |
71 base::Closure auth_failed_callback_; | 70 base::Closure auth_failed_callback_; |
72 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; | 71 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; |
73 | 72 |
74 OAuthTokenGetter* oauth_token_getter_; | 73 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; |
75 | 74 |
76 // Number of times we tried to connect without success. | 75 // Number of times we tried to connect without success. |
77 int reconnect_attempts_; | 76 int reconnect_attempts_; |
78 | 77 |
79 base::OneShotTimer<SignalingConnector> timer_; | 78 base::OneShotTimer<SignalingConnector> timer_; |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); | 80 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); |
82 }; | 81 }; |
83 | 82 |
84 } // namespace remoting | 83 } // namespace remoting |
85 | 84 |
86 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ | 85 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ |
OLD | NEW |