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

Side by Side Diff: remoting/host/policy_hack/policy_watcher_linux.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 | « remoting/host/config_file_watcher.cc ('k') | no next file » | 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 // 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 virtual ~PolicyWatcherLinux() {} 62 virtual ~PolicyWatcherLinux() {}
63 63
64 protected: 64 protected:
65 virtual void StartWatchingInternal() OVERRIDE { 65 virtual void StartWatchingInternal() OVERRIDE {
66 DCHECK(OnPolicyWatcherThread()); 66 DCHECK(OnPolicyWatcherThread());
67 watcher_.reset(new base::files::FilePathWatcher()); 67 watcher_.reset(new base::files::FilePathWatcher());
68 68
69 if (!config_dir_.empty() && 69 if (!config_dir_.empty() &&
70 !watcher_->Watch( 70 !watcher_->Watch(
71 config_dir_, 71 config_dir_, false,
72 base::Bind(&PolicyWatcherLinux::OnFilePathChanged, 72 base::Bind(&PolicyWatcherLinux::OnFilePathChanged,
73 weak_factory_.GetWeakPtr()))) { 73 weak_factory_.GetWeakPtr()))) {
74 OnFilePathChanged(config_dir_, true); 74 OnFilePathChanged(config_dir_, true);
75 } 75 }
76 76
77 // There might have been changes to the directory in the time between 77 // There might have been changes to the directory in the time between
78 // construction of the loader and initialization of the watcher. Call reload 78 // construction of the loader and initialization of the watcher. Call reload
79 // to detect if that is the case. 79 // to detect if that is the case.
80 Reload(); 80 Reload();
81 81
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 }; 246 };
247 247
248 PolicyWatcher* PolicyWatcher::Create( 248 PolicyWatcher* PolicyWatcher::Create(
249 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 249 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
250 FilePath policy_dir(kPolicyDir); 250 FilePath policy_dir(kPolicyDir);
251 return new PolicyWatcherLinux(task_runner, policy_dir); 251 return new PolicyWatcherLinux(task_runner, policy_dir);
252 } 252 }
253 253
254 } // namespace policy_hack 254 } // namespace policy_hack
255 } // namespace remoting 255 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/config_file_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698