summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authordcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 19:29:49 +0000
committerdcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 19:29:49 +0000
commitf9fb95aa64cc5991f6047b574c86de909ba4c7b2 (patch)
treef003e6d36520a0f69ddb2e9c96687e05896ee186 /remoting
parent29a499015996ab8fda8691db44d2b07dee04945d (diff)
downloadchromium_src-f9fb95aa64cc5991f6047b574c86de909ba4c7b2.zip
chromium_src-f9fb95aa64cc5991f6047b574c86de909ba4c7b2.tar.gz
chromium_src-f9fb95aa64cc5991f6047b574c86de909ba4c7b2.tar.bz2
[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
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/policy_hack/policy_watcher_mac.mm19
1 files changed, 18 insertions, 1 deletions
diff --git a/remoting/host/policy_hack/policy_watcher_mac.mm b/remoting/host/policy_hack/policy_watcher_mac.mm
index 26b3213..d0dd473 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