Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: remoting/host/policy_hack/policy_watcher_mac.mm

Issue 10836075: [Chromoting] Let the Mac host policy watcher read string-valued policies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use CFCast Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698