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 20 matching lines...) Expand all Loading... |
31 ConfigDirPolicyLoader::ConfigDirPolicyLoader(const FilePath& config_dir, | 31 ConfigDirPolicyLoader::ConfigDirPolicyLoader(const FilePath& config_dir, |
32 PolicyScope scope) | 32 PolicyScope scope) |
33 : config_dir_(config_dir), | 33 : config_dir_(config_dir), |
34 scope_(scope) {} | 34 scope_(scope) {} |
35 | 35 |
36 ConfigDirPolicyLoader::~ConfigDirPolicyLoader() {} | 36 ConfigDirPolicyLoader::~ConfigDirPolicyLoader() {} |
37 | 37 |
38 void ConfigDirPolicyLoader::InitOnFile() { | 38 void ConfigDirPolicyLoader::InitOnFile() { |
39 base::files::FilePathWatcher::Callback callback = | 39 base::files::FilePathWatcher::Callback callback = |
40 base::Bind(&ConfigDirPolicyLoader::OnFileUpdated, base::Unretained(this)); | 40 base::Bind(&ConfigDirPolicyLoader::OnFileUpdated, base::Unretained(this)); |
41 mandatory_watcher_.Watch(config_dir_.Append(kMandatoryConfigDir), callback); | 41 mandatory_watcher_.Watch(config_dir_.Append(kMandatoryConfigDir), false, |
42 recommended_watcher_.Watch(config_dir_.Append(kRecommendedConfigDir), | 42 callback); |
| 43 recommended_watcher_.Watch(config_dir_.Append(kRecommendedConfigDir), false, |
43 callback); | 44 callback); |
44 } | 45 } |
45 | 46 |
46 scoped_ptr<PolicyBundle> ConfigDirPolicyLoader::Load() { | 47 scoped_ptr<PolicyBundle> ConfigDirPolicyLoader::Load() { |
47 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 48 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
48 LoadFromPath(config_dir_.Append(kMandatoryConfigDir), | 49 LoadFromPath(config_dir_.Append(kMandatoryConfigDir), |
49 POLICY_LEVEL_MANDATORY, | 50 POLICY_LEVEL_MANDATORY, |
50 bundle.get()); | 51 bundle.get()); |
51 LoadFromPath(config_dir_.Append(kRecommendedConfigDir), | 52 LoadFromPath(config_dir_.Append(kRecommendedConfigDir), |
52 POLICY_LEVEL_RECOMMENDED, | 53 POLICY_LEVEL_RECOMMENDED, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
186 void ConfigDirPolicyLoader::OnFileUpdated(const FilePath& path, bool error) { | 187 void ConfigDirPolicyLoader::OnFileUpdated(const FilePath& path, bool error) { |
187 if (!error) | 188 if (!error) |
188 Reload(false); | 189 Reload(false); |
189 } | 190 } |
190 | 191 |
191 } // namespace policy | 192 } // namespace policy |
OLD | NEW |