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 16 matching lines...) Expand all Loading... |
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( |
35 XmppSignalStrategy* signal_strategy, | 35 XmppSignalStrategy* signal_strategy, |
36 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker, | 36 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker, |
| 37 scoped_ptr<OAuthTokenGetter> oauth_token_getter, |
37 const base::Closure& auth_failed_callback); | 38 const base::Closure& auth_failed_callback); |
38 ~SignalingConnector() override; | 39 ~SignalingConnector() override; |
39 | 40 |
40 // May be called immediately after the constructor to enable OAuth | |
41 // access token updating. | |
42 void EnableOAuth(scoped_ptr<OAuthTokenGetter> oauth_token_getter); | |
43 | |
44 // OAuthTokenGetter callback. | 41 // OAuthTokenGetter callback. |
45 void OnAccessToken(OAuthTokenGetter::Status status, | 42 void OnAccessToken(OAuthTokenGetter::Status status, |
46 const std::string& user_email, | 43 const std::string& user_email, |
47 const std::string& access_token); | 44 const std::string& access_token); |
48 | 45 |
49 // SignalStrategy::Listener interface. | 46 // SignalStrategy::Listener interface. |
50 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 47 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
51 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 48 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |
52 | 49 |
53 // NetworkChangeNotifier::ConnectionTypeObserver interface. | 50 // NetworkChangeNotifier::ConnectionTypeObserver interface. |
(...skipping 20 matching lines...) Expand all Loading... |
74 int reconnect_attempts_; | 71 int reconnect_attempts_; |
75 | 72 |
76 base::OneShotTimer<SignalingConnector> timer_; | 73 base::OneShotTimer<SignalingConnector> timer_; |
77 | 74 |
78 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); | 75 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); |
79 }; | 76 }; |
80 | 77 |
81 } // namespace remoting | 78 } // namespace remoting |
82 | 79 |
83 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ | 80 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H_ |
OLD | NEW |