| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/host/policy_hack/policy_watcher.h" | 5 #include "remoting/host/policy_hack/policy_watcher.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 policy_bundle_id, | 53 policy_bundle_id, |
| 54 &valid); | 54 &valid); |
| 55 if (valid) { | 55 if (valid) { |
| 56 policy.SetBoolean(policy_name, value); | 56 policy.SetBoolean(policy_name, value); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (i.value().GetType() == base::DictionaryValue::TYPE_STRING) { | 60 if (i.value().GetType() == base::DictionaryValue::TYPE_STRING) { |
| 61 base::ScopedCFTypeRef<CFPropertyListRef> property_list( | 61 base::ScopedCFTypeRef<CFPropertyListRef> property_list( |
| 62 CFPreferencesCopyAppValue(policy_key, policy_bundle_id)); | 62 CFPreferencesCopyAppValue(policy_key, policy_bundle_id)); |
| 63 if (property_list.get() != NULL) { | 63 if (property_list.get() != nullptr) { |
| 64 CFStringRef policy_value = base::mac::CFCast<CFStringRef>( | 64 CFStringRef policy_value = base::mac::CFCast<CFStringRef>( |
| 65 property_list.get()); | 65 property_list.get()); |
| 66 if (policy_value != NULL) { | 66 if (policy_value != nullptr) { |
| 67 policy.SetString(policy_name, | 67 policy.SetString(policy_name, |
| 68 base::SysCFStringRefToUTF8(policy_value)); | 68 base::SysCFStringRefToUTF8(policy_value)); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Set policy. Policy must be set (even if it is empty) so that the | 76 // Set policy. Policy must be set (even if it is empty) so that the |
| 77 // default policy is picked up the first time reload is called. | 77 // default policy is picked up the first time reload is called. |
| 78 UpdatePolicies(&policy); | 78 UpdatePolicies(&policy); |
| 79 | 79 |
| 80 // Reschedule task. | 80 // Reschedule task. |
| 81 ScheduleFallbackReloadTask(); | 81 ScheduleFallbackReloadTask(); |
| 82 } | 82 } |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 scoped_ptr<PolicyWatcher> PolicyWatcher::Create( | 85 scoped_ptr<PolicyWatcher> PolicyWatcher::Create( |
| 86 policy::PolicyService* policy_service, | 86 policy::PolicyService* policy_service, |
| 87 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 87 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 88 return make_scoped_ptr(new PolicyWatcherMac(task_runner)); | 88 return make_scoped_ptr(new PolicyWatcherMac(task_runner)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace policy_hack | 91 } // namespace policy_hack |
| 92 } // namespace remoting | 92 } // namespace remoting |
| OLD | NEW |