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/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 base::mac::ScopedCFTypeRef<CFStringRef> policy_key( | 49 base::mac::ScopedCFTypeRef<CFStringRef> policy_key( |
50 base::SysUTF8ToCFStringRef(policy_name)); | 50 base::SysUTF8ToCFStringRef(policy_name)); |
51 Boolean valid = false; | 51 Boolean valid = false; |
52 bool allowed = CFPreferencesGetAppBooleanValue(policy_key, | 52 bool allowed = CFPreferencesGetAppBooleanValue(policy_key, |
53 policy_bundle_id, | 53 policy_bundle_id, |
54 &valid); | 54 &valid); |
55 if (valid) { | 55 if (valid) { |
56 policy.SetBoolean(policy_name, allowed); | 56 policy.SetBoolean(policy_name, allowed); |
57 } | 57 } |
58 } | 58 } |
| 59 // TODO(simonmorris): Read policies whose names are in kStringPolicyNames. |
59 } | 60 } |
60 | 61 |
61 // Set policy. Policy must be set (even if it is empty) so that the | 62 // Set policy. Policy must be set (even if it is empty) so that the |
62 // default policy is picked up the first time reload is called. | 63 // default policy is picked up the first time reload is called. |
63 UpdatePolicies(&policy); | 64 UpdatePolicies(&policy); |
64 | 65 |
65 // Reschedule task. | 66 // Reschedule task. |
66 ScheduleFallbackReloadTask(); | 67 ScheduleFallbackReloadTask(); |
67 } | 68 } |
68 }; | 69 }; |
69 | 70 |
70 PolicyWatcher* PolicyWatcher::Create( | 71 PolicyWatcher* PolicyWatcher::Create( |
71 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 72 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
72 return new PolicyWatcherMac(task_runner); | 73 return new PolicyWatcherMac(task_runner); |
73 } | 74 } |
74 | 75 |
75 } // namespace policy_hack | 76 } // namespace policy_hack |
76 } // namespace remoting | 77 } // namespace remoting |
OLD | NEW |