| 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 "chrome/browser/policy/config_dir_policy_loader.h" | 5 #include "chrome/browser/policy/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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::PlatformFileInfo 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 (!file_util::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, |
| 106 base::FileEnumerator::FILES); | 106 base::FileEnumerator::FILES); |
| 107 for (base::FilePath config_file = file_enumerator.Next(); | 107 for (base::FilePath config_file = file_enumerator.Next(); |
| 108 !config_file.empty(); | 108 !config_file.empty(); |
| 109 config_file = file_enumerator.Next()) { | 109 config_file = file_enumerator.Next()) { |
| 110 if (file_util::GetFileInfo(config_file, &info) && !info.is_directory) | 110 if (base::GetFileInfo(config_file, &info) && !info.is_directory) |
| 111 last_modification = std::max(last_modification, info.last_modified); | 111 last_modification = std::max(last_modification, info.last_modified); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 return last_modification; | 115 return last_modification; |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ConfigDirPolicyLoader::LoadFromPath(const base::FilePath& path, | 118 void ConfigDirPolicyLoader::LoadFromPath(const base::FilePath& path, |
| 119 PolicyLevel level, | 119 PolicyLevel level, |
| 120 PolicyBundle* bundle) { | 120 PolicyBundle* bundle) { |
| (...skipping 102 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 |