Index: remoting/host/remoting_me2me_host.cc |
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc |
index 7b7d3e3bb09cc8985738c476e40603ebbaee2262..90e148b3a8872e5fcc2132f588d10781c311df09 100644 |
--- a/remoting/host/remoting_me2me_host.cc |
+++ b/remoting/host/remoting_me2me_host.cc |
@@ -214,6 +214,7 @@ class HostProcess |
bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); |
bool OnHostTokenUrlPolicyUpdate(const GURL& token_url, |
const GURL& token_validation_url); |
+ bool OnPairingPolicyUpdate(bool pairing_enabled); |
void StartHost(); |
@@ -267,6 +268,7 @@ class HostProcess |
scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
bool allow_nat_traversal_; |
std::string talkgadget_prefix_; |
+ bool allow_pairing_; |
bool curtain_required_; |
GURL token_url_; |
@@ -298,6 +300,7 @@ HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, |
: context_(context.Pass()), |
state_(HOST_INITIALIZING), |
allow_nat_traversal_(true), |
+ allow_pairing_(true), |
curtain_required_(false), |
#if defined(REMOTING_MULTI_PROCESS) |
desktop_session_connector_(NULL), |
@@ -482,10 +485,11 @@ void HostProcess::CreateAuthenticatorFactory() { |
} |
scoped_refptr<protocol::PairingRegistry> pairing_registry = NULL; |
- scoped_ptr<protocol::PairingRegistry::Delegate> delegate( |
- CreatePairingRegistryDelegate(context_->file_task_runner())); |
- if (delegate) { |
- pairing_registry = new protocol::PairingRegistry(delegate.Pass()); |
+ if (allow_pairing_) { |
+ scoped_ptr<protocol::PairingRegistry::Delegate> delegate( |
+ CreatePairingRegistryDelegate(context_->file_task_runner())); |
+ if (delegate) |
+ pairing_registry = new protocol::PairingRegistry(delegate.Pass()); |
} |
scoped_ptr<protocol::AuthenticatorFactory> factory; |
@@ -755,6 +759,11 @@ void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { |
restart_required |= OnHostTokenUrlPolicyUpdate( |
GURL(token_url_string), GURL(token_validation_url_string)); |
} |
+ if (policies->GetBoolean( |
+ policy_hack::PolicyWatcher::kHostAllowClientPairing, |
+ &bool_value)) { |
+ restart_required |= OnPairingPolicyUpdate(bool_value); |
+ } |
if (state_ == HOST_INITIALIZING) { |
StartHost(); |
@@ -900,6 +909,20 @@ bool HostProcess::OnHostTokenUrlPolicyUpdate( |
return false; |
} |
+bool HostProcess::OnPairingPolicyUpdate(bool allow_pairing) { |
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
+ |
+ if (allow_pairing_ == allow_pairing) |
+ return false; |
+ |
+ if (allow_pairing) |
+ LOG(INFO) << "Policy enables client pairing."; |
+ else |
+ LOG(INFO) << "Policy disables client pairing."; |
+ allow_pairing_ = allow_pairing; |
+ return true; |
+} |
+ |
void HostProcess::StartHost() { |
DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
DCHECK(!host_); |