| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 PolicyLevel level, | 122 PolicyLevel level, |
| 123 PolicyBundle* bundle) { | 123 PolicyBundle* bundle) { |
| 124 // Enumerate the files and sort them lexicographically. | 124 // Enumerate the files and sort them lexicographically. |
| 125 std::set<base::FilePath> files; | 125 std::set<base::FilePath> files; |
| 126 base::FileEnumerator file_enumerator(path, false, | 126 base::FileEnumerator file_enumerator(path, false, |
| 127 base::FileEnumerator::FILES); | 127 base::FileEnumerator::FILES); |
| 128 for (base::FilePath config_file_path = file_enumerator.Next(); | 128 for (base::FilePath config_file_path = file_enumerator.Next(); |
| 129 !config_file_path.empty(); config_file_path = file_enumerator.Next()) | 129 !config_file_path.empty(); config_file_path = file_enumerator.Next()) |
| 130 files.insert(config_file_path); | 130 files.insert(config_file_path); |
| 131 | 131 |
| 132 PolicyLoadStatusSample status; | 132 PolicyLoadStatusUmaReporter status; |
| 133 if (files.empty()) { | 133 if (files.empty()) { |
| 134 status.Add(POLICY_LOAD_STATUS_NO_POLICY); | 134 status.Add(POLICY_LOAD_STATUS_NO_POLICY); |
| 135 return; | 135 return; |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Start with an empty dictionary and merge the files' contents. | 138 // Start with an empty dictionary and merge the files' contents. |
| 139 // The files are processed in reverse order because |MergeFrom| gives priority | 139 // The files are processed in reverse order because |MergeFrom| gives priority |
| 140 // to existing keys, but the ConfigDirPolicyProvider gives priority to the | 140 // to existing keys, but the ConfigDirPolicyProvider gives priority to the |
| 141 // last file in lexicographic order. | 141 // last file in lexicographic order. |
| 142 for (std::set<base::FilePath>::reverse_iterator config_file_iter = | 142 for (std::set<base::FilePath>::reverse_iterator config_file_iter = |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, | 230 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, |
| 231 bool error) { | 231 bool error) { |
| 232 if (!error) | 232 if (!error) |
| 233 Reload(false); | 233 Reload(false); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace policy | 236 } // namespace policy |
| OLD | NEW |