| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/policy/configuration_policy_provider_mac.h" | 5 #include "chrome/browser/policy/configuration_policy_provider_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 | 10 |
| 11 namespace policy { | 11 namespace policy { |
| 12 | 12 |
| 13 ConfigurationPolicyProviderMac::ConfigurationPolicyProviderMac( | 13 ConfigurationPolicyProviderMac::ConfigurationPolicyProviderMac( |
| 14 const StaticPolicyValueMap& policy_map) | 14 const StaticPolicyValueMap& policy_map) |
| 15 : ConfigurationPolicyProvider(policy_map), | 15 : ConfigurationPolicyProvider(policy_map), |
| 16 preferences_(new MacPreferences()) { | 16 preferences_(new MacPreferences()) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 ConfigurationPolicyProviderMac::ConfigurationPolicyProviderMac( | 19 ConfigurationPolicyProviderMac::ConfigurationPolicyProviderMac( |
| 20 const StaticPolicyValueMap& policy_map, MacPreferences* preferences) | 20 const StaticPolicyValueMap& policy_map, MacPreferences* preferences) |
| 21 : ConfigurationPolicyProvider(policy_map), preferences_(preferences) { | 21 : ConfigurationPolicyProvider(policy_map), preferences_(preferences) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool ConfigurationPolicyProviderMac::Provide(ConfigurationPolicyStore* store) { | 24 bool ConfigurationPolicyProviderMac::Provide(ConfigurationPolicyStore* store) { |
| 25 const PolicyValueMap& mapping = policy_value_map(); | 25 const PolicyValueMap& mapping = policy_value_map(); |
| 26 | 26 |
| 27 for (PolicyValueMap::const_iterator current = mapping.begin(); | 27 for (PolicyValueMap::const_iterator current = mapping.begin(); |
| 28 current != mapping.end(); ++current) { | 28 current != mapping.end(); ++current) { |
| 29 scoped_cftyperef<CFStringRef> name( | 29 base::mac::ScopedCFTypeRef<CFStringRef> name( |
| 30 base::SysUTF8ToCFStringRef(current->name)); | 30 base::SysUTF8ToCFStringRef(current->name)); |
| 31 scoped_cftyperef<CFPropertyListRef> value( | 31 base::mac::ScopedCFTypeRef<CFPropertyListRef> value( |
| 32 preferences_->CopyAppValue(name, kCFPreferencesCurrentApplication)); | 32 preferences_->CopyAppValue(name, kCFPreferencesCurrentApplication)); |
| 33 if (!value.get()) | 33 if (!value.get()) |
| 34 continue; | 34 continue; |
| 35 if (!preferences_->AppValueIsForced(name, kCFPreferencesCurrentApplication)) | 35 if (!preferences_->AppValueIsForced(name, kCFPreferencesCurrentApplication)) |
| 36 continue; | 36 continue; |
| 37 | 37 |
| 38 switch (current->value_type) { | 38 switch (current->value_type) { |
| 39 case Value::TYPE_STRING: | 39 case Value::TYPE_STRING: |
| 40 if (CFGetTypeID(value) == CFStringGetTypeID()) { | 40 if (CFGetTypeID(value) == CFStringGetTypeID()) { |
| 41 std::string string_value = | 41 std::string string_value = |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 default: | 87 default: |
| 88 NOTREACHED(); | 88 NOTREACHED(); |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace policy | 96 } // namespace policy |
| OLD | NEW |