Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Unified Diff: remoting/host/signaling_connector.cc

Issue 10378110: Verify that xmpp_login specified in the config matches auth token. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/signaling_connector.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/signaling_connector.cc
diff --git a/remoting/host/signaling_connector.cc b/remoting/host/signaling_connector.cc
index cba384a6e31bebf814dbf556f0845bcbc7647a8e..072eced53f3ff783ee2be1834f669aedadbbedcf 100644
--- a/remoting/host/signaling_connector.cc
+++ b/remoting/host/signaling_connector.cc
@@ -31,10 +31,14 @@ SignalingConnector::OAuthCredentials::OAuthCredentials(
client_info(client_info_value) {
}
-SignalingConnector::SignalingConnector(XmppSignalStrategy* signal_strategy)
+SignalingConnector::SignalingConnector(
+ XmppSignalStrategy* signal_strategy,
+ const base::Closure& auth_failed_callback)
: signal_strategy_(signal_strategy),
+ auth_failed_callback_(auth_failed_callback),
reconnect_attempts_(0),
refreshing_oauth_token_(false) {
+ DCHECK(!auth_failed_callback_.is_null());
net::NetworkChangeNotifier::AddOnlineStateObserver(this);
net::NetworkChangeNotifier::AddIPAddressObserver(this);
signal_strategy_->AddListener(this);
@@ -49,10 +53,8 @@ SignalingConnector::~SignalingConnector() {
void SignalingConnector::EnableOAuth(
scoped_ptr<OAuthCredentials> oauth_credentials,
- const base::Closure& oauth_failed_callback,
net::URLRequestContextGetter* url_context) {
oauth_credentials_ = oauth_credentials.Pass();
- oauth_failed_callback_ = oauth_failed_callback;
gaia_oauth_client_.reset(new GaiaOAuthClient(kGaiaOAuth2Url, url_context));
}
@@ -66,7 +68,14 @@ void SignalingConnector::OnSignalStrategyStateChange(
} else if (state == SignalStrategy::DISCONNECTED) {
LOG(INFO) << "Signaling disconnected.";
reconnect_attempts_++;
- ScheduleTryReconnect();
+
+ // If authentication failed then we have an invalid OAuth token,
+ // inform the upper layer about it.
+ if (signal_strategy_->GetError() == SignalStrategy::AUTHENTICATION_FAILED) {
+ auth_failed_callback_.Run();
+ } else {
+ ScheduleTryReconnect();
+ }
}
}
@@ -106,7 +115,7 @@ void SignalingConnector::OnOAuthError() {
LOG(ERROR) << "OAuth: invalid credentials.";
refreshing_oauth_token_ = false;
reconnect_attempts_++;
- oauth_failed_callback_.Run();
+ auth_failed_callback_.Run();
}
void SignalingConnector::OnNetworkError(int response_code) {
« no previous file with comments | « remoting/host/signaling_connector.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698