Index: remoting/host/policy_hack/policy_watcher_mac.mm |
diff --git a/remoting/host/policy_hack/policy_watcher_mac.mm b/remoting/host/policy_hack/policy_watcher_mac.mm |
index 26b3213f20bf246acb7dd2bac1778f9357113c19..d0dd47322168ec526d3bb623391853d5c18d00ad 100644 |
--- a/remoting/host/policy_hack/policy_watcher_mac.mm |
+++ b/remoting/host/policy_hack/policy_watcher_mac.mm |
@@ -7,6 +7,7 @@ |
#include <CoreFoundation/CoreFoundation.h> |
#include "base/compiler_specific.h" |
+#include "base/mac/foundation_util.h" |
#include "base/mac/scoped_cftyperef.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/single_thread_task_runner.h" |
@@ -56,7 +57,23 @@ class PolicyWatcherMac : public PolicyWatcher { |
policy.SetBoolean(policy_name, allowed); |
} |
} |
- // TODO(simonmorris): Read policies whose names are in kStringPolicyNames. |
+ for (int i = 0; i < kStringPolicyNamesNum; ++i) { |
+ const char* policy_name = kStringPolicyNames[i]; |
+ base::mac::ScopedCFTypeRef<CFStringRef> policy_key( |
+ base::SysUTF8ToCFStringRef(policy_name)); |
+ base::mac::ScopedCFTypeRef<CFPropertyListRef> property_list( |
+ CFPreferencesCopyAppValue(policy_key, policy_bundle_id)); |
+ if (property_list.get() != NULL) { |
+ CFStringRef policy_value = base::mac::CFCast<CFStringRef>( |
+ property_list.get()); |
+ if (policy_value != NULL) { |
+ policy.SetString(policy_name, |
+ base::SysCFStringRefToUTF8(policy_value)); |
+ } else { |
+ LOG(WARNING) << "Policy " << policy_name << ": value not a string."; |
+ } |
+ } |
+ } |
} |
// Set policy. Policy must be set (even if it is empty) so that the |