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 13 matching lines...) Expand all Loading... |
24 // backoff. It also monitors network state and reconnects signalling | 24 // backoff. It also monitors network state and reconnects signalling |
25 // whenever online state changes or IP address changes. | 25 // whenever online state changes or IP address changes. |
26 class SignalingConnector | 26 class SignalingConnector |
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::OnlineStateObserver, | 30 public net::NetworkChangeNotifier::OnlineStateObserver, |
31 public net::NetworkChangeNotifier::IPAddressObserver, | 31 public net::NetworkChangeNotifier::IPAddressObserver, |
32 public GaiaOAuthClient::Delegate { | 32 public GaiaOAuthClient::Delegate { |
33 public: | 33 public: |
| 34 // This structure contains information required to perform |
| 35 // authentication to OAuth2. |
34 struct OAuthCredentials { | 36 struct OAuthCredentials { |
35 OAuthCredentials(const std::string& login_value, | 37 OAuthCredentials(const std::string& login_value, |
36 const std::string& refresh_token_value); | 38 const std::string& refresh_token_value, |
| 39 const OAuthClientInfo& client_info); |
| 40 |
| 41 // The user's account name (i.e. their email address). |
37 std::string login; | 42 std::string login; |
| 43 |
| 44 // Token delegating authority to us to act as the user. |
38 std::string refresh_token; | 45 std::string refresh_token; |
| 46 |
| 47 // Credentials identifying the application to OAuth. |
| 48 OAuthClientInfo client_info; |
39 }; | 49 }; |
40 | 50 |
41 // OAuth token is updated refreshed when |oauth_credentials| is | 51 // OAuth token is updated refreshed when |oauth_credentials| is |
42 // not NULL. | 52 // not NULL. |
43 SignalingConnector(XmppSignalStrategy* signal_strategy); | 53 SignalingConnector(XmppSignalStrategy* signal_strategy); |
44 virtual ~SignalingConnector(); | 54 virtual ~SignalingConnector(); |
45 | 55 |
46 void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials, | 56 void EnableOAuth(scoped_ptr<OAuthCredentials> oauth_credentials, |
47 const base::Closure& oauth_failed_callback, | 57 const base::Closure& oauth_failed_callback, |
48 URLRequestContextGetter* url_context); | 58 URLRequestContextGetter* url_context); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::Time auth_token_expiry_time_; | 93 base::Time auth_token_expiry_time_; |
84 | 94 |
85 base::OneShotTimer<SignalingConnector> timer_; | 95 base::OneShotTimer<SignalingConnector> timer_; |
86 | 96 |
87 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); | 97 DISALLOW_COPY_AND_ASSIGN(SignalingConnector); |
88 }; | 98 }; |
89 | 99 |
90 } // namespace remoting | 100 } // namespace remoting |
91 | 101 |
92 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H | 102 #endif // REMOTING_HOST_SIGNALING_CONNECTOR_H |
OLD | NEW |