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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Allowing unrecognized policy names allows presence of | 221 // Allowing unrecognized policy names allows presence of |
222 // 1) comments (i.e. JSON of the form: { "_comment": "blah", ... }), | 222 // 1) comments (i.e. JSON of the form: { "_comment": "blah", ... }), |
223 // 2) policies intended for future/newer versions of the host, | 223 // 2) policies intended for future/newer versions of the host, |
224 // 3) policies not supported on all OS-s (i.e. RemoteAccessHostMatchUsername | 224 // 3) policies not supported on all OS-s (i.e. RemoteAccessHostMatchUsername |
225 // is not supported on Windows and therefore policy_templates.json omits | 225 // is not supported on Windows and therefore policy_templates.json omits |
226 // schema for this policy on this particular platform). | 226 // schema for this policy on this particular platform). |
227 auto strategy = policy::SCHEMA_ALLOW_UNKNOWN_TOPLEVEL; | 227 auto strategy = policy::SCHEMA_ALLOW_UNKNOWN_TOPLEVEL; |
228 | 228 |
229 std::string path; | 229 std::string path; |
230 std::string error; | 230 std::string error; |
231 bool changed; | 231 bool changed = false; |
232 const policy::Schema* schema = GetPolicySchema(); | 232 const policy::Schema* schema = GetPolicySchema(); |
233 if (schema->Normalize(policy_dict.get(), strategy, &path, &error, &changed)) { | 233 if (schema->Normalize(policy_dict.get(), strategy, &path, &error, &changed)) { |
234 if (changed) { | 234 if (changed) { |
235 LOG(WARNING) << "Unknown (unrecognized or unsupported) policy: " << path | 235 LOG(WARNING) << "Unknown (unrecognized or unsupported) policy: " << path |
236 << ": " << error; | 236 << ": " << error; |
237 } | 237 } |
238 UpdatePolicies(policy_dict.get()); | 238 UpdatePolicies(policy_dict.get()); |
239 } else { | 239 } else { |
240 LOG(ERROR) << "Invalid policy contents: " << path << ": " << error; | 240 LOG(ERROR) << "Invalid policy contents: " << path << ": " << error; |
241 SignalPolicyError(); | 241 SignalPolicyError(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 policy::POLICY_SCOPE_MACHINE)); | 298 policy::POLICY_SCOPE_MACHINE)); |
299 #else | 299 #else |
300 #error OS that is not yet supported by PolicyWatcher code. | 300 #error OS that is not yet supported by PolicyWatcher code. |
301 #endif | 301 #endif |
302 | 302 |
303 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); | 303 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); |
304 #endif // !(OS_CHROMEOS) | 304 #endif // !(OS_CHROMEOS) |
305 } | 305 } |
306 | 306 |
307 } // namespace remoting | 307 } // namespace remoting |
OLD | NEW |