| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Most of this code is copied from: | 5 // Most of this code is copied from: |
| 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} | 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} |
| 7 | 7 |
| 8 #include "remoting/host/policy_watcher.h" | 8 #include "remoting/host/policy_watcher.h" |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 scoped_ptr<policy::SchemaRegistry> schema_registry( | 81 scoped_ptr<policy::SchemaRegistry> schema_registry( |
| 82 new policy::SchemaRegistry()); | 82 new policy::SchemaRegistry()); |
| 83 schema_registry->RegisterComponent(GetPolicyNamespace(), schema); | 83 schema_registry->RegisterComponent(GetPolicyNamespace(), schema); |
| 84 return schema_registry; | 84 return schema_registry; |
| 85 } | 85 } |
| 86 | 86 |
| 87 scoped_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary( | 87 scoped_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary( |
| 88 const policy::PolicyMap& current) { | 88 const policy::PolicyMap& current) { |
| 89 const char kPolicyNameSubstring[] = "RemoteAccessHost"; | 89 const char kPolicyNameSubstring[] = "RemoteAccessHost"; |
| 90 scoped_ptr<base::DictionaryValue> policy_dict(new base::DictionaryValue()); | 90 scoped_ptr<base::DictionaryValue> policy_dict(new base::DictionaryValue()); |
| 91 for (auto it = current.begin(); it != current.end(); ++it) { | 91 for (auto it = current.begin(); it != current.end(); |
| 92 const std::string& key = it->first; | 92 current.next_domominant(&it)) { |
| 93 const std::string& key = it->first.name; |
| 93 const base::Value* value = it->second.value; | 94 const base::Value* value = it->second.value; |
| 94 | 95 |
| 95 // Copying only Chromoting-specific policies helps avoid false alarms | 96 // Copying only Chromoting-specific policies helps avoid false alarms |
| 96 // raised by NormalizePolicies below (such alarms shutdown the host). | 97 // raised by NormalizePolicies below (such alarms shutdown the host). |
| 97 // TODO(lukasza): Removing this somewhat brittle filtering will be possible | 98 // TODO(lukasza): Removing this somewhat brittle filtering will be possible |
| 98 // after having separate, Chromoting-specific schema. | 99 // after having separate, Chromoting-specific schema. |
| 99 if (key.find(kPolicyNameSubstring) != std::string::npos) { | 100 if (key.find(kPolicyNameSubstring) != std::string::npos) { |
| 100 policy_dict->Set(key, value->DeepCopy()); | 101 policy_dict->Set(key, value->DeepCopy()); |
| 101 } | 102 } |
| 102 } | 103 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 policy::POLICY_SCOPE_MACHINE)); | 372 policy::POLICY_SCOPE_MACHINE)); |
| 372 #else | 373 #else |
| 373 #error OS that is not yet supported by PolicyWatcher code. | 374 #error OS that is not yet supported by PolicyWatcher code. |
| 374 #endif | 375 #endif |
| 375 | 376 |
| 376 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); | 377 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); |
| 377 #endif // !(OS_CHROMEOS) | 378 #endif // !(OS_CHROMEOS) |
| 378 } | 379 } |
| 379 | 380 |
| 380 } // namespace remoting | 381 } // namespace remoting |
| OLD | NEW |