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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 20864002: Added PIN-less auth policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 7 years, 5 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/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_);
« chrome/test/data/policy/policy_test_cases.json ('K') | « remoting/host/policy_hack/policy_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698