| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/policy/core/common/policy_loader_ios.h" | 5 #include "components/policy/core/common/policy_loader_ios.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #import <UIKit/UIKit.h> | 9 #import <UIKit/UIKit.h> |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } else { | 145 } else { |
| 146 LoadNSDictionaryToPolicyBundle(properties, bundle.get()); | 146 LoadNSDictionaryToPolicyBundle(properties, bundle.get()); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, std::string()); | 151 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, std::string()); |
| 152 size_t count = bundle->Get(chrome_ns).size(); | 152 size_t count = bundle->Get(chrome_ns).size(); |
| 153 UMA_HISTOGRAM_COUNTS_100("Enterprise.IOSPolicies", count); | 153 UMA_HISTOGRAM_COUNTS_100("Enterprise.IOSPolicies", count); |
| 154 | 154 |
| 155 return bundle.Pass(); | 155 return bundle; |
| 156 } | 156 } |
| 157 | 157 |
| 158 base::Time PolicyLoaderIOS::LastModificationTime() { | 158 base::Time PolicyLoaderIOS::LastModificationTime() { |
| 159 return last_notification_time_; | 159 return last_notification_time_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void PolicyLoaderIOS::UserDefaultsChanged() { | 162 void PolicyLoaderIOS::UserDefaultsChanged() { |
| 163 // The base class coalesces multiple Reload() calls into a single Load() if | 163 // The base class coalesces multiple Reload() calls into a single Load() if |
| 164 // the LastModificationTime() has a small delta between Reload() calls. | 164 // the LastModificationTime() has a small delta between Reload() calls. |
| 165 // This coalesces the multiple notifications sent during startup into a single | 165 // This coalesces the multiple notifications sent during startup into a single |
| (...skipping 11 matching lines...) Expand all Loading... |
| 177 PropertyToValue(static_cast<CFPropertyListRef>(dictionary)); | 177 PropertyToValue(static_cast<CFPropertyListRef>(dictionary)); |
| 178 base::DictionaryValue* dict = NULL; | 178 base::DictionaryValue* dict = NULL; |
| 179 if (value && value->GetAsDictionary(&dict)) { | 179 if (value && value->GetAsDictionary(&dict)) { |
| 180 PolicyMap& map = bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); | 180 PolicyMap& map = bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); |
| 181 map.LoadFrom(dict, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 181 map.LoadFrom(dict, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 182 POLICY_SOURCE_PLATFORM); | 182 POLICY_SOURCE_PLATFORM); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace policy | 186 } // namespace policy |
| OLD | NEW |