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

Unified Diff: base/directory_watcher.h

Issue 6377: Add a DirectoryWatcher class, allowing objects to be notified whenever... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: base/directory_watcher.h
===================================================================
--- base/directory_watcher.h (revision 0)
+++ base/directory_watcher.h (revision 0)
@@ -0,0 +1,42 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This module provides a way to monitor a directory for changes.
+
+#ifndef BASE_DIRECTORY_WATCHER_H_
+#define BASE_DIRECTORY_WATCHER_H_
+
+#include <string>
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+
+class FilePath;
+
+// This class lets you register interest in changes on a directory.
+// The delegate will get called whenever a file is added or changed in the
+// directory.
+class DirectoryWatcher {
+ public:
+ class Delegate {
+ public:
+ virtual void OnDirectoryChanged(const FilePath& path) = 0;
+ };
+
+ DirectoryWatcher();
+ ~DirectoryWatcher();
+
+ // Register interest in any changes in the directory |path|.
+ // OnDirectoryChanged will be called back for each change within the dir.
+ // Returns false on error.
+ bool Watch(const FilePath& path, Delegate* delegate);
+
+ private:
+ class Impl;
+ friend class Impl;
+ scoped_refptr<Impl> impl_;
+
+ DISALLOW_COPY_AND_ASSIGN(DirectoryWatcher);
+};
+
+#endif // BASE_DIRECTORY_WATCHER_H_
Property changes on: base\directory_watcher.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698