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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 return make_scoped_ptr(new PolicyWatcher(policy_service, nullptr, nullptr, | 276 return make_scoped_ptr(new PolicyWatcher(policy_service, nullptr, nullptr, |
277 CreateSchemaRegistry())); | 277 CreateSchemaRegistry())); |
278 #else // !defined(OS_CHROMEOS) | 278 #else // !defined(OS_CHROMEOS) |
279 DCHECK(!policy_service); | 279 DCHECK(!policy_service); |
280 | 280 |
281 // Create platform-specific PolicyLoader. Always read the Chrome policies | 281 // Create platform-specific PolicyLoader. Always read the Chrome policies |
282 // (even on Chromium) so that policy enforcement can't be bypassed by running | 282 // (even on Chromium) so that policy enforcement can't be bypassed by running |
283 // Chromium. | 283 // Chromium. |
284 scoped_ptr<policy::AsyncPolicyLoader> policy_loader; | 284 scoped_ptr<policy::AsyncPolicyLoader> policy_loader; |
285 #if defined(OS_WIN) | 285 #if defined(OS_WIN) |
286 policy_loader = policy::PolicyLoaderWin::Create( | 286 policy_loader.reset(new policy::PolicyLoaderWin( |
287 file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome"); | 287 file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome", |
| 288 nullptr)); // nullptr = don't use GPO / always read from the registry. |
288 #elif defined(OS_MACOSX) | 289 #elif defined(OS_MACOSX) |
289 CFStringRef bundle_id = CFSTR("com.google.Chrome"); | 290 CFStringRef bundle_id = CFSTR("com.google.Chrome"); |
290 policy_loader.reset(new policy::PolicyLoaderMac( | 291 policy_loader.reset(new policy::PolicyLoaderMac( |
291 file_task_runner, | 292 file_task_runner, |
292 policy::PolicyLoaderMac::GetManagedPolicyPath(bundle_id), | 293 policy::PolicyLoaderMac::GetManagedPolicyPath(bundle_id), |
293 new MacPreferences(), bundle_id)); | 294 new MacPreferences(), bundle_id)); |
294 #elif defined(OS_POSIX) && !defined(OS_ANDROID) | 295 #elif defined(OS_POSIX) && !defined(OS_ANDROID) |
295 policy_loader.reset(new policy::ConfigDirPolicyLoader( | 296 policy_loader.reset(new policy::ConfigDirPolicyLoader( |
296 file_task_runner, | 297 file_task_runner, |
297 base::FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")), | 298 base::FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")), |
298 policy::POLICY_SCOPE_MACHINE)); | 299 policy::POLICY_SCOPE_MACHINE)); |
299 #else | 300 #else |
300 #error OS that is not yet supported by PolicyWatcher code. | 301 #error OS that is not yet supported by PolicyWatcher code. |
301 #endif | 302 #endif |
302 | 303 |
303 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); | 304 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); |
304 #endif // !(OS_CHROMEOS) | 305 #endif // !(OS_CHROMEOS) |
305 } | 306 } |
306 | 307 |
307 } // namespace remoting | 308 } // namespace remoting |
OLD | NEW |