Commit f9fb95aa authored by dcaiafa@chromium.org's avatar dcaiafa@chromium.org

[Chromoting] Let the Mac host policy watcher read string-valued policies.

BUG=132864


Review URL: https://chromiumcodereview.appspot.com/10836075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149675 0039d316-1c4b-4281-b951-d872f2087c98
parent 29a49901
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
...@@ -56,7 +57,23 @@ class PolicyWatcherMac : public PolicyWatcher { ...@@ -56,7 +57,23 @@ class PolicyWatcherMac : public PolicyWatcher {
policy.SetBoolean(policy_name, allowed); 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 // Set policy. Policy must be set (even if it is empty) so that the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment