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

Unified Diff: remoting/host/policy_watcher.cc

Issue 2252243002: Adding a policy for using the uiAccess enabled It2Me binary on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/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() {

Powered by Google App Engine
This is Rietveld 408576698