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/config_dir_policy_provider.h" | 5 #include "chrome/browser/policy/config_dir_policy_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 policy->MergeDictionary(static_cast<DictionaryValue*>(value.get())); | 140 policy->MergeDictionary(static_cast<DictionaryValue*>(value.get())); |
141 } | 141 } |
142 | 142 |
143 return policy; | 143 return policy; |
144 } | 144 } |
145 | 145 |
146 bool PolicyDirLoader::IsSafeToReloadPolicy(const base::Time& now, | 146 bool PolicyDirLoader::IsSafeToReloadPolicy(const base::Time& now, |
147 base::TimeDelta* delay) { | 147 base::TimeDelta* delay) { |
148 DCHECK(delay); | 148 DCHECK(delay); |
149 file_util::FileInfo dir_info; | 149 base::PlatformFileInfo dir_info; |
150 | 150 |
151 // Reading an empty directory or a file is always safe. | 151 // Reading an empty directory or a file is always safe. |
152 if (!file_util::GetFileInfo(config_dir_, &dir_info) || | 152 if (!file_util::GetFileInfo(config_dir_, &dir_info) || |
153 !dir_info.is_directory) { | 153 !dir_info.is_directory) { |
154 last_modification_file_ = base::Time(); | 154 last_modification_file_ = base::Time(); |
155 return true; | 155 return true; |
156 } | 156 } |
157 | 157 |
158 // If there was a change since the last recorded modification, wait some more. | 158 // If there was a change since the last recorded modification, wait some more. |
159 base::TimeDelta settleInterval( | 159 base::TimeDelta settleInterval( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 i != mapping->end(); ++i) { | 259 i != mapping->end(); ++i) { |
260 const PolicyValueMapEntry& entry(*i); | 260 const PolicyValueMapEntry& entry(*i); |
261 Value* value; | 261 Value* value; |
262 if (policies->Get(entry.name, &value) && value->IsType(entry.value_type)) | 262 if (policies->Get(entry.name, &value) && value->IsType(entry.value_type)) |
263 store->Apply(entry.policy_type, value->DeepCopy()); | 263 store->Apply(entry.policy_type, value->DeepCopy()); |
264 } | 264 } |
265 | 265 |
266 // TODO(mnissler): Handle preference overrides once |ConfigurationPolicyStore| | 266 // TODO(mnissler): Handle preference overrides once |ConfigurationPolicyStore| |
267 // supports it. | 267 // supports it. |
268 } | 268 } |
OLD | NEW |