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/device_management_policy_cache.h" | 5 #include "chrome/browser/policy/device_management_policy_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 policy_copy->CopyFrom(policy); | 128 policy_copy->CopyFrom(policy); |
129 BrowserThread::PostTask( | 129 BrowserThread::PostTask( |
130 BrowserThread::FILE, | 130 BrowserThread::FILE, |
131 FROM_HERE, | 131 FROM_HERE, |
132 new PersistPolicyTask(backing_file_path_, policy_copy, now, false)); | 132 new PersistPolicyTask(backing_file_path_, policy_copy, now, false)); |
133 return new_policy_differs; | 133 return new_policy_differs; |
134 } | 134 } |
135 | 135 |
136 DictionaryValue* DeviceManagementPolicyCache::GetPolicy() { | 136 DictionaryValue* DeviceManagementPolicyCache::GetPolicy() { |
137 AutoLock lock(lock_); | 137 AutoLock lock(lock_); |
138 return static_cast<DictionaryValue*>(policy_->DeepCopy()); | 138 return policy_->DeepCopy(); |
139 } | 139 } |
140 | 140 |
141 void DeviceManagementPolicyCache::SetDeviceUnmanaged(bool is_device_unmanaged) { | 141 void DeviceManagementPolicyCache::SetDeviceUnmanaged(bool is_device_unmanaged) { |
142 if (is_device_unmanaged_ == is_device_unmanaged) | 142 if (is_device_unmanaged_ == is_device_unmanaged) |
143 return; | 143 return; |
144 | 144 |
145 is_device_unmanaged_ = is_device_unmanaged; | 145 is_device_unmanaged_ = is_device_unmanaged; |
146 base::Time now(base::Time::NowFromSystemTime()); | 146 base::Time now(base::Time::NowFromSystemTime()); |
147 DictionaryValue* empty = new DictionaryValue(); | 147 DictionaryValue* empty = new DictionaryValue(); |
148 { | 148 { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 DeviceManagementPolicyCache::DecodeValue(named_value->value()); | 269 DeviceManagementPolicyCache::DecodeValue(named_value->value()); |
270 if (decoded_value) | 270 if (decoded_value) |
271 result->Set(named_value->name(), decoded_value); | 271 result->Set(named_value->name(), decoded_value); |
272 } | 272 } |
273 } | 273 } |
274 } | 274 } |
275 return result; | 275 return result; |
276 } | 276 } |
277 | 277 |
278 } // namespace policy | 278 } // namespace policy |
OLD | NEW |