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

Unified Diff: remoting/host/policy_watcher.cc

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Don't read real policies. Created 3 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
Index: remoting/host/policy_watcher.cc
diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
index 9bb9007185590716a766da7166b8710e783a195d..3fbdd62ff75675205e09125969c51b3ec2f0451c 100644
--- a/remoting/host/policy_watcher.cc
+++ b/remoting/host/policy_watcher.cc
@@ -158,6 +158,38 @@ void PolicyWatcher::StartWatching(
}
}
+std::unique_ptr<base::DictionaryValue> PolicyWatcher::GetCurrentPolicies() {
+ // If old_policies is empty, then the PolicyService has not yet provided
joedow 2017/05/05 14:42:15 s/old_policies/|old_policies_|
Jamie 2017/05/05 16:49:06 Done.
rkjnsn 2017/05/05 16:53:04 This needs a trailing underscore: old_policies_
Jamie 2017/05/05 16:57:58 Done.
+ // policies, so just return the default values. Otherwise, old_policies
joedow 2017/05/05 14:42:15 same here
Jamie 2017/05/05 16:49:06 Done.
rkjnsn 2017/05/05 16:53:04 Same here
Jamie 2017/05/05 16:57:58 Done.
+ // already contains all the supported polcies, defaults and overrides.
joedow 2017/05/05 14:42:15 s/polcies/policies
Jamie 2017/05/05 16:49:06 Done.
+ return old_policies_->size() == 0 ? GetDefaultPolicies()
+ : old_policies_->CreateDeepCopy();
+}
+
+std::unique_ptr<base::DictionaryValue> PolicyWatcher::GetDefaultPolicies() {
+ auto result = base::MakeUnique<base::DictionaryValue>();
+ result->SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
+ result->SetBoolean(key::kRemoteAccessHostRequireCurtain, false);
+ result->SetBoolean(key::kRemoteAccessHostMatchUsername, false);
+ result->Set(key::kRemoteAccessHostClientDomainList,
+ base::MakeUnique<base::ListValue>());
+ result->Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
+ result->SetString(key::kRemoteAccessHostTalkGadgetPrefix,
+ kDefaultHostTalkGadgetPrefix);
+ result->SetString(key::kRemoteAccessHostTokenUrl, std::string());
+ result->SetString(key::kRemoteAccessHostTokenValidationUrl, std::string());
+ result->SetString(key::kRemoteAccessHostTokenValidationCertificateIssuer,
+ std::string());
+ result->SetBoolean(key::kRemoteAccessHostAllowClientPairing, true);
+ result->SetBoolean(key::kRemoteAccessHostAllowGnubbyAuth, true);
+ result->SetBoolean(key::kRemoteAccessHostAllowRelayedConnection, true);
+ result->SetString(key::kRemoteAccessHostUdpPortRange, "");
+ result->SetBoolean(key::kRemoteAccessHostAllowUiAccessForRemoteAssistance,
+ false);
+ return result;
+}
+
void PolicyWatcher::SignalPolicyError() {
old_policies_->Clear();
policy_error_callback_.Run();
@@ -169,36 +201,13 @@ PolicyWatcher::PolicyWatcher(
std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider,
std::unique_ptr<policy::SchemaRegistry> owned_schema_registry)
: old_policies_(new base::DictionaryValue()),
- default_values_(new base::DictionaryValue()),
+ default_values_(GetDefaultPolicies()),
policy_service_(policy_service),
owned_schema_registry_(std::move(owned_schema_registry)),
owned_policy_provider_(std::move(owned_policy_provider)),
owned_policy_service_(std::move(owned_policy_service)) {
DCHECK(policy_service_);
DCHECK(owned_schema_registry_);
-
- // Initialize the default values for each policy.
- default_values_->SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
- default_values_->SetBoolean(key::kRemoteAccessHostRequireCurtain, false);
- default_values_->SetBoolean(key::kRemoteAccessHostMatchUsername, false);
- default_values_->Set(key::kRemoteAccessHostClientDomainList,
- base::MakeUnique<base::ListValue>());
- default_values_->Set(key::kRemoteAccessHostDomainList,
- base::MakeUnique<base::ListValue>());
- default_values_->SetString(key::kRemoteAccessHostTalkGadgetPrefix,
- kDefaultHostTalkGadgetPrefix);
- default_values_->SetString(key::kRemoteAccessHostTokenUrl, std::string());
- default_values_->SetString(key::kRemoteAccessHostTokenValidationUrl,
- std::string());
- default_values_->SetString(
- key::kRemoteAccessHostTokenValidationCertificateIssuer, std::string());
- default_values_->SetBoolean(key::kRemoteAccessHostAllowClientPairing, true);
- default_values_->SetBoolean(key::kRemoteAccessHostAllowGnubbyAuth, true);
- default_values_->SetBoolean(key::kRemoteAccessHostAllowRelayedConnection,
- true);
- default_values_->SetString(key::kRemoteAccessHostUdpPortRange, "");
- default_values_->SetBoolean(
- key::kRemoteAccessHostAllowUiAccessForRemoteAssistance, false);
}
PolicyWatcher::~PolicyWatcher() {

Powered by Google App Engine
This is Rietveld 408576698