| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 new policy::SchemaRegistry()); | 83 new policy::SchemaRegistry()); |
| 84 schema_registry->RegisterComponent(GetPolicyNamespace(), schema); | 84 schema_registry->RegisterComponent(GetPolicyNamespace(), schema); |
| 85 return schema_registry; | 85 return schema_registry; |
| 86 } | 86 } |
| 87 | 87 |
| 88 std::unique_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary( | 88 std::unique_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary( |
| 89 const policy::PolicyMap& current) { | 89 const policy::PolicyMap& current) { |
| 90 const char kPolicyNameSubstring[] = "RemoteAccessHost"; | 90 const char kPolicyNameSubstring[] = "RemoteAccessHost"; |
| 91 std::unique_ptr<base::DictionaryValue> policy_dict( | 91 std::unique_ptr<base::DictionaryValue> policy_dict( |
| 92 new base::DictionaryValue()); | 92 new base::DictionaryValue()); |
| 93 for (auto it = current.begin(); it != current.end(); ++it) { | 93 for (const auto& entry : current) { |
| 94 const std::string& key = it->first; | 94 const std::string& key = entry.first; |
| 95 const base::Value* value = it->second.value; | 95 const base::Value* value = entry.second.value.get(); |
| 96 | 96 |
| 97 // Copying only Chromoting-specific policies helps avoid false alarms | 97 // Copying only Chromoting-specific policies helps avoid false alarms |
| 98 // raised by NormalizePolicies below (such alarms shutdown the host). | 98 // raised by NormalizePolicies below (such alarms shutdown the host). |
| 99 // TODO(lukasza): Removing this somewhat brittle filtering will be possible | 99 // TODO(lukasza): Removing this somewhat brittle filtering will be possible |
| 100 // after having separate, Chromoting-specific schema. | 100 // after having separate, Chromoting-specific schema. |
| 101 if (key.find(kPolicyNameSubstring) != std::string::npos) { | 101 if (key.find(kPolicyNameSubstring) != std::string::npos) { |
| 102 policy_dict->Set(key, value->CreateDeepCopy()); | 102 policy_dict->Set(key, value->CreateDeepCopy()); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 CreateSchemaRegistry())); | 382 CreateSchemaRegistry())); |
| 383 #else | 383 #else |
| 384 #error OS that is not yet supported by PolicyWatcher code. | 384 #error OS that is not yet supported by PolicyWatcher code. |
| 385 #endif | 385 #endif |
| 386 | 386 |
| 387 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); | 387 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); |
| 388 #endif // !(OS_CHROMEOS) | 388 #endif // !(OS_CHROMEOS) |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace remoting | 391 } // namespace remoting |
| OLD | NEW |