OLD | NEW |
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 "components/policy/core/common/config_dir_policy_loader.h" | 5 #include "components/policy/core/common/config_dir_policy_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return bundle.Pass(); | 85 return bundle.Pass(); |
86 } | 86 } |
87 | 87 |
88 base::Time ConfigDirPolicyLoader::LastModificationTime() { | 88 base::Time ConfigDirPolicyLoader::LastModificationTime() { |
89 static const base::FilePath::CharType* kConfigDirSuffixes[] = { | 89 static const base::FilePath::CharType* kConfigDirSuffixes[] = { |
90 kMandatoryConfigDir, | 90 kMandatoryConfigDir, |
91 kRecommendedConfigDir, | 91 kRecommendedConfigDir, |
92 }; | 92 }; |
93 | 93 |
94 base::Time last_modification = base::Time(); | 94 base::Time last_modification = base::Time(); |
95 base::PlatformFileInfo info; | 95 base::File::Info info; |
96 | 96 |
97 for (size_t i = 0; i < arraysize(kConfigDirSuffixes); ++i) { | 97 for (size_t i = 0; i < arraysize(kConfigDirSuffixes); ++i) { |
98 base::FilePath path(config_dir_.Append(kConfigDirSuffixes[i])); | 98 base::FilePath path(config_dir_.Append(kConfigDirSuffixes[i])); |
99 | 99 |
100 // Skip if the file doesn't exist, or it isn't a directory. | 100 // Skip if the file doesn't exist, or it isn't a directory. |
101 if (!base::GetFileInfo(path, &info) || !info.is_directory) | 101 if (!base::GetFileInfo(path, &info) || !info.is_directory) |
102 continue; | 102 continue; |
103 | 103 |
104 // Enumerate the files and find the most recent modification timestamp. | 104 // Enumerate the files and find the most recent modification timestamp. |
105 base::FileEnumerator file_enumerator(path, false, | 105 base::FileEnumerator file_enumerator(path, false, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, | 226 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, |
227 bool error) { | 227 bool error) { |
228 if (!error) | 228 if (!error) |
229 Reload(false); | 229 Reload(false); |
230 } | 230 } |
231 | 231 |
232 } // namespace policy | 232 } // namespace policy |
OLD | NEW |