| Index: remoting/host/policy_watcher.cc
|
| diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
|
| index ea90d6373928aa7e905e2ecd63142588fa9e3a4c..b3af29089bf52a913fe6def1efa3245eefaf72c2 100644
|
| --- a/remoting/host/policy_watcher.cc
|
| +++ b/remoting/host/policy_watcher.cc
|
| @@ -85,23 +85,34 @@ std::unique_ptr<policy::SchemaRegistry> CreateSchemaRegistry() {
|
| return schema_registry;
|
| }
|
|
|
| +void RetrievePoliciesByNamePrefix(const policy::PolicyMap& current_policies,
|
| + const std::string& policy_name_prefix,
|
| + base::DictionaryValue* policy_dict) {
|
| + for (const auto& policy_entry : current_policies) {
|
| + const std::string& key = policy_entry.first;
|
| + const base::Value* value = policy_entry.second.value.get();
|
| +
|
| + if (key.find(policy_name_prefix) != std::string::npos) {
|
| + policy_dict->Set(key, value->CreateDeepCopy());
|
| + }
|
| + }
|
| +}
|
| +
|
| std::unique_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary(
|
| const policy::PolicyMap& current) {
|
| - const char kPolicyNameSubstring[] = "RemoteAccessHost";
|
| + const char kRemoteAccessHostPolicyNamePrefix[] = "RemoteAccessHost";
|
| + const char kRemoteAssistanceHostPolicyNamePrefix[] = "RemoteAssistanceHost";
|
| std::unique_ptr<base::DictionaryValue> policy_dict(
|
| new base::DictionaryValue());
|
| - for (const auto& entry : current) {
|
| - const std::string& key = entry.first;
|
| - const base::Value* value = entry.second.value.get();
|
| -
|
| - // Copying only Chromoting-specific policies helps avoid false alarms
|
| - // raised by NormalizePolicies below (such alarms shutdown the host).
|
| - // TODO(lukasza): Removing this somewhat brittle filtering will be possible
|
| - // after having separate, Chromoting-specific schema.
|
| - if (key.find(kPolicyNameSubstring) != std::string::npos) {
|
| - policy_dict->Set(key, value->CreateDeepCopy());
|
| - }
|
| - }
|
| +
|
| + // Copying only Chromoting-specific policies helps avoid false alarms raised
|
| + // by NormalizePolicies below (such alarms shutdown the host).
|
| + // TODO(lukasza): Removing this somewhat brittle filtering will be possible
|
| + // after having separate, Chromoting-specific schema.
|
| + RetrievePoliciesByNamePrefix(current, kRemoteAccessHostPolicyNamePrefix,
|
| + policy_dict.get());
|
| + RetrievePoliciesByNamePrefix(current, kRemoteAssistanceHostPolicyNamePrefix,
|
| + policy_dict.get());
|
|
|
| return policy_dict;
|
| }
|
| @@ -195,6 +206,7 @@ PolicyWatcher::PolicyWatcher(
|
| default_values_->SetBoolean(key::kRemoteAccessHostAllowRelayedConnection,
|
| true);
|
| default_values_->SetString(key::kRemoteAccessHostUdpPortRange, "");
|
| + default_values_->SetBoolean(key::kRemoteAssistanceHostAllowUiAccess, false);
|
| }
|
|
|
| PolicyWatcher::~PolicyWatcher() {
|
|
|