| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return make_scoped_ptr( | 259 return make_scoped_ptr( |
| 260 new PolicyWatcher(policy_service, nullptr, nullptr, nullptr)); | 260 new PolicyWatcher(policy_service, nullptr, nullptr, nullptr)); |
| 261 #else // !defined(OS_CHROMEOS) | 261 #else // !defined(OS_CHROMEOS) |
| 262 DCHECK(!policy_service); | 262 DCHECK(!policy_service); |
| 263 | 263 |
| 264 // Create platform-specific PolicyLoader. Always read the Chrome policies | 264 // Create platform-specific PolicyLoader. Always read the Chrome policies |
| 265 // (even on Chromium) so that policy enforcement can't be bypassed by running | 265 // (even on Chromium) so that policy enforcement can't be bypassed by running |
| 266 // Chromium. | 266 // Chromium. |
| 267 scoped_ptr<policy::AsyncPolicyLoader> policy_loader; | 267 scoped_ptr<policy::AsyncPolicyLoader> policy_loader; |
| 268 #if defined(OS_WIN) | 268 #if defined(OS_WIN) |
| 269 policy_loader = policy::PolicyLoaderWin::Create( | 269 policy_loader.reset(new policy::PolicyLoaderWin( |
| 270 file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome"); | 270 file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome", |
| 271 nullptr)); // nullptr = don't use GPO / always read from the registry. |
| 271 #elif defined(OS_MACOSX) | 272 #elif defined(OS_MACOSX) |
| 272 CFStringRef bundle_id = CFSTR("com.google.Chrome"); | 273 CFStringRef bundle_id = CFSTR("com.google.Chrome"); |
| 273 policy_loader.reset(new policy::PolicyLoaderMac( | 274 policy_loader.reset(new policy::PolicyLoaderMac( |
| 274 file_task_runner, | 275 file_task_runner, |
| 275 policy::PolicyLoaderMac::GetManagedPolicyPath(bundle_id), | 276 policy::PolicyLoaderMac::GetManagedPolicyPath(bundle_id), |
| 276 new MacPreferences(), bundle_id)); | 277 new MacPreferences(), bundle_id)); |
| 277 #elif defined(OS_POSIX) && !defined(OS_ANDROID) | 278 #elif defined(OS_POSIX) && !defined(OS_ANDROID) |
| 278 policy_loader.reset(new policy::ConfigDirPolicyLoader( | 279 policy_loader.reset(new policy::ConfigDirPolicyLoader( |
| 279 file_task_runner, | 280 file_task_runner, |
| 280 base::FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")), | 281 base::FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")), |
| 281 policy::POLICY_SCOPE_MACHINE)); | 282 policy::POLICY_SCOPE_MACHINE)); |
| 282 #else | 283 #else |
| 283 #error OS that is not yet supported by PolicyWatcher code. | 284 #error OS that is not yet supported by PolicyWatcher code. |
| 284 #endif | 285 #endif |
| 285 | 286 |
| 286 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); | 287 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); |
| 287 #endif // !(OS_CHROMEOS) | 288 #endif // !(OS_CHROMEOS) |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace remoting | 291 } // namespace remoting |
| OLD | NEW |