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 #include "remoting/host/signaling_connector.h" | 5 #include "remoting/host/signaling_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "google_apis/google_api_keys.h" | 10 #include "google_apis/google_api_keys.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 signal_strategy_->AddListener(this); | 38 signal_strategy_->AddListener(this); |
39 ScheduleTryReconnect(); | 39 ScheduleTryReconnect(); |
40 } | 40 } |
41 | 41 |
42 SignalingConnector::~SignalingConnector() { | 42 SignalingConnector::~SignalingConnector() { |
43 signal_strategy_->RemoveListener(this); | 43 signal_strategy_->RemoveListener(this); |
44 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 44 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
45 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 45 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
46 } | 46 } |
47 | 47 |
48 void SignalingConnector::EnableOAuth(OAuthTokenGetter* oauth_token_getter) { | 48 void SignalingConnector::EnableOAuth( |
49 oauth_token_getter_ = oauth_token_getter; | 49 scoped_ptr<OAuthTokenGetter> oauth_token_getter) { |
| 50 oauth_token_getter_ = oauth_token_getter.Pass(); |
50 } | 51 } |
51 | 52 |
52 void SignalingConnector::OnSignalStrategyStateChange( | 53 void SignalingConnector::OnSignalStrategyStateChange( |
53 SignalStrategy::State state) { | 54 SignalStrategy::State state) { |
54 DCHECK(CalledOnValidThread()); | 55 DCHECK(CalledOnValidThread()); |
55 | 56 |
56 if (state == SignalStrategy::CONNECTED) { | 57 if (state == SignalStrategy::CONNECTED) { |
57 HOST_LOG << "Signaling connected."; | 58 HOST_LOG << "Signaling connected."; |
58 reconnect_attempts_ = 0; | 59 reconnect_attempts_ = 0; |
59 } else if (state == SignalStrategy::DISCONNECTED) { | 60 } else if (state == SignalStrategy::DISCONNECTED) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 168 } |
168 | 169 |
169 if (signal_strategy_->GetState() == SignalStrategy::DISCONNECTED) { | 170 if (signal_strategy_->GetState() == SignalStrategy::DISCONNECTED) { |
170 HOST_LOG << "Attempting to connect signaling."; | 171 HOST_LOG << "Attempting to connect signaling."; |
171 oauth_token_getter_->CallWithToken( | 172 oauth_token_getter_->CallWithToken( |
172 base::Bind(&SignalingConnector::OnAccessToken, AsWeakPtr())); | 173 base::Bind(&SignalingConnector::OnAccessToken, AsWeakPtr())); |
173 } | 174 } |
174 } | 175 } |
175 | 176 |
176 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |