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

Side by Side Diff: remoting/host/policy_hack/policy_watcher_mac.mm

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/local_input_monitor_mac.mm ('k') | remoting/host/setup/daemon_controller_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 30 matching lines...) Expand all
41 41
42 virtual void Reload() OVERRIDE { 42 virtual void Reload() OVERRIDE {
43 DCHECK(OnPolicyWatcherThread()); 43 DCHECK(OnPolicyWatcherThread());
44 base::DictionaryValue policy; 44 base::DictionaryValue policy;
45 45
46 CFStringRef policy_bundle_id = CFSTR("com.google.Chrome"); 46 CFStringRef policy_bundle_id = CFSTR("com.google.Chrome");
47 if (CFPreferencesAppSynchronize(policy_bundle_id)) { 47 if (CFPreferencesAppSynchronize(policy_bundle_id)) {
48 for (base::DictionaryValue::Iterator i(Defaults()); 48 for (base::DictionaryValue::Iterator i(Defaults());
49 !i.IsAtEnd(); i.Advance()) { 49 !i.IsAtEnd(); i.Advance()) {
50 const std::string& policy_name = i.key(); 50 const std::string& policy_name = i.key();
51 base::mac::ScopedCFTypeRef<CFStringRef> policy_key( 51 base::ScopedCFTypeRef<CFStringRef> policy_key(
52 base::SysUTF8ToCFStringRef(policy_name)); 52 base::SysUTF8ToCFStringRef(policy_name));
53 53
54 if (i.value().GetType() == base::DictionaryValue::TYPE_BOOLEAN) { 54 if (i.value().GetType() == base::DictionaryValue::TYPE_BOOLEAN) {
55 Boolean valid = false; 55 Boolean valid = false;
56 bool value = CFPreferencesGetAppBooleanValue(policy_key, 56 bool value = CFPreferencesGetAppBooleanValue(policy_key,
57 policy_bundle_id, 57 policy_bundle_id,
58 &valid); 58 &valid);
59 if (valid) { 59 if (valid) {
60 policy.SetBoolean(policy_name, value); 60 policy.SetBoolean(policy_name, value);
61 } 61 }
62 } 62 }
63 63
64 if (i.value().GetType() == base::DictionaryValue::TYPE_STRING) { 64 if (i.value().GetType() == base::DictionaryValue::TYPE_STRING) {
65 base::mac::ScopedCFTypeRef<CFPropertyListRef> property_list( 65 base::ScopedCFTypeRef<CFPropertyListRef> property_list(
66 CFPreferencesCopyAppValue(policy_key, policy_bundle_id)); 66 CFPreferencesCopyAppValue(policy_key, policy_bundle_id));
67 if (property_list.get() != NULL) { 67 if (property_list.get() != NULL) {
68 CFStringRef policy_value = base::mac::CFCast<CFStringRef>( 68 CFStringRef policy_value = base::mac::CFCast<CFStringRef>(
69 property_list.get()); 69 property_list.get());
70 if (policy_value != NULL) { 70 if (policy_value != NULL) {
71 policy.SetString(policy_name, 71 policy.SetString(policy_name,
72 base::SysCFStringRefToUTF8(policy_value)); 72 base::SysCFStringRefToUTF8(policy_value));
73 } 73 }
74 } 74 }
75 } 75 }
(...skipping 10 matching lines...) Expand all
86 } 86 }
87 }; 87 };
88 88
89 PolicyWatcher* PolicyWatcher::Create( 89 PolicyWatcher* PolicyWatcher::Create(
90 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 90 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
91 return new PolicyWatcherMac(task_runner); 91 return new PolicyWatcherMac(task_runner);
92 } 92 }
93 93
94 } // namespace policy_hack 94 } // namespace policy_hack
95 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/local_input_monitor_mac.mm ('k') | remoting/host/setup/daemon_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698