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 // Most of this code is copied from various classes in | 5 // Most of this code is copied from various classes in |
6 // src/chrome/browser/policy. In particular, look at | 6 // src/chrome/browser/policy. In particular, look at |
7 // | 7 // |
8 // file_based_policy_loader.{h,cc} | 8 // file_based_policy_loader.{h,cc} |
9 // config_dir_policy_provider.{h,cc} | 9 // config_dir_policy_provider.{h,cc} |
10 // | 10 // |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (base::GetFileInfo(config_file, &file_info) && | 118 if (base::GetFileInfo(config_file, &file_info) && |
119 !file_info.is_directory) { | 119 !file_info.is_directory) { |
120 last_modification = std::max(last_modification, | 120 last_modification = std::max(last_modification, |
121 file_info.last_modified); | 121 file_info.last_modified); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 return last_modification; | 125 return last_modification; |
126 } | 126 } |
127 | 127 |
128 // Returns NULL if the policy dictionary couldn't be read. | 128 // Returns nullptr if the policy dictionary couldn't be read. |
129 scoped_ptr<base::DictionaryValue> Load() { | 129 scoped_ptr<base::DictionaryValue> Load() { |
130 DCHECK(OnPolicyWatcherThread()); | 130 DCHECK(OnPolicyWatcherThread()); |
131 // Enumerate the files and sort them lexicographically. | 131 // Enumerate the files and sort them lexicographically. |
132 std::set<base::FilePath> files; | 132 std::set<base::FilePath> files; |
133 base::FileEnumerator file_enumerator(config_dir_, false, | 133 base::FileEnumerator file_enumerator(config_dir_, false, |
134 base::FileEnumerator::FILES); | 134 base::FileEnumerator::FILES); |
135 for (base::FilePath config_file_path = file_enumerator.Next(); | 135 for (base::FilePath config_file_path = file_enumerator.Next(); |
136 !config_file_path.empty(); config_file_path = file_enumerator.Next()) | 136 !config_file_path.empty(); config_file_path = file_enumerator.Next()) |
137 files.insert(config_file_path); | 137 files.insert(config_file_path); |
138 | 138 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 scoped_ptr<PolicyWatcher> PolicyWatcher::Create( | 248 scoped_ptr<PolicyWatcher> PolicyWatcher::Create( |
249 policy::PolicyService* policy_service, | 249 policy::PolicyService* policy_service, |
250 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 250 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
251 base::FilePath policy_dir(kPolicyDir); | 251 base::FilePath policy_dir(kPolicyDir); |
252 return make_scoped_ptr(new PolicyWatcherLinux(task_runner, policy_dir)); | 252 return make_scoped_ptr(new PolicyWatcherLinux(task_runner, policy_dir)); |
253 } | 253 } |
254 | 254 |
255 } // namespace policy_hack | 255 } // namespace policy_hack |
256 } // namespace remoting | 256 } // namespace remoting |
OLD | NEW |