Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/policy/config_dir_policy_loader.cc

Issue 11415066: FilePathWatcher::Watch() - Listen for sub directory changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added more test cases Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | chrome/browser/policy/policy_loader_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | chrome/browser/policy/policy_loader_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698