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

Unified Diff: remoting/host/signaling_connector.cc

Issue 10873050: [Chromoting] Hook up host talkgadget policy checks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra comments/whitespace Created 8 years, 4 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
Index: remoting/host/signaling_connector.cc
diff --git a/remoting/host/signaling_connector.cc b/remoting/host/signaling_connector.cc
index 9e95219a39f1540e52bb31e66cab17985bc7ed01..bdce5bdec97a32097bef7cf0ff37a7a15065b9f9 100644
--- a/remoting/host/signaling_connector.cc
+++ b/remoting/host/signaling_connector.cc
@@ -6,7 +6,10 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "net/url_request/url_fetcher.h"
#include "remoting/host/chromoting_host_context.h"
+#include "remoting/host/connection_block_checker.h"
+#include "remoting/host/constants.h"
#include "remoting/host/url_request_context.h"
namespace remoting {
@@ -33,8 +36,11 @@ SignalingConnector::OAuthCredentials::OAuthCredentials(
SignalingConnector::SignalingConnector(
XmppSignalStrategy* signal_strategy,
+ ChromotingHostContext* context,
+ std::string talkgadget_prefix,
const base::Closure& auth_failed_callback)
: signal_strategy_(signal_strategy),
+ context_(context),
auth_failed_callback_(auth_failed_callback),
reconnect_attempts_(0),
refreshing_oauth_token_(false) {
@@ -42,6 +48,8 @@ SignalingConnector::SignalingConnector(
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
net::NetworkChangeNotifier::AddIPAddressObserver(this);
signal_strategy_->AddListener(this);
+ connection_block_checker_.reset(
+ new ConnectionBlockChecker(context_, talkgadget_prefix));
ScheduleTryReconnect();
}
@@ -52,11 +60,10 @@ SignalingConnector::~SignalingConnector() {
}
void SignalingConnector::EnableOAuth(
- scoped_ptr<OAuthCredentials> oauth_credentials,
- net::URLRequestContextGetter* url_context) {
+ scoped_ptr<OAuthCredentials> oauth_credentials) {
oauth_credentials_ = oauth_credentials.Pass();
gaia_oauth_client_.reset(new GaiaOAuthClient(
- OAuthProviderInfo::GetDefault(), url_context));
+ OAuthProviderInfo::GetDefault(), context_->url_request_context_getter()));
}
void SignalingConnector::OnSignalStrategyStateChange(
@@ -85,12 +92,6 @@ bool SignalingConnector::OnSignalStrategyIncomingStanza(
return false;
}
-void SignalingConnector::OnIPAddressChanged() {
- DCHECK(CalledOnValidThread());
- LOG(INFO) << "IP address has changed.";
- ResetAndTryReconnect();
-}
-
void SignalingConnector::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
DCHECK(CalledOnValidThread());
@@ -100,6 +101,12 @@ void SignalingConnector::OnConnectionTypeChanged(
}
}
+void SignalingConnector::OnIPAddressChanged() {
+ DCHECK(CalledOnValidThread());
+ LOG(INFO) << "IP address has changed.";
+ ResetAndTryReconnect();
+}
+
void SignalingConnector::OnRefreshTokenResponse(const std::string& user_email,
const std::string& access_token,
int expires_seconds) {
@@ -163,6 +170,17 @@ void SignalingConnector::ResetAndTryReconnect() {
void SignalingConnector::TryReconnect() {
DCHECK(CalledOnValidThread());
+ DCHECK(connection_block_checker_.get());
+
+ ConnectionBlockChecker::Status status;
+ status = connection_block_checker_->GetStatus();
+ if (status == ConnectionBlockChecker::UNKNOWN) {
+ ScheduleTryReconnect();
+ return;
+ } else if (status == ConnectionBlockChecker::DENY) {
+ return;
Sergey Ulanov 2012/08/28 00:33:42 This will keep the host running even though we kno
garykac 2012/08/29 00:07:15 Done.
+ }
+
if (signal_strategy_->GetState() == SignalStrategy::DISCONNECTED) {
bool need_new_auth_token = oauth_credentials_.get() &&
(auth_token_expiry_time_.is_null() ||

Powered by Google App Engine
This is Rietveld 408576698