• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // This file exists for systems for which Chromium does not support watching
6 // file paths. This includes Unix systems that don't have the inotify headers
7 // and thus cannot build file_watcher_inotify.cc.
8 
9 #include "base/files/file_path_watcher.h"
10 
11 #include <memory>
12 
13 #include "base/notreached.h"
14 #include "base/task/sequenced_task_runner.h"
15 
16 namespace base {
17 
18 namespace {
19 
20 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
21  public:
22   FilePathWatcherImpl() = default;
23   FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
24   FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
25   ~FilePathWatcherImpl() override = default;
26 
27   // FilePathWatcher::PlatformDelegate:
Watch(const FilePath & path,Type type,const FilePathWatcher::Callback & callback)28   bool Watch(const FilePath& path,
29              Type type,
30              const FilePathWatcher::Callback& callback) override {
31     DCHECK(!callback.is_null());
32 
33     NOTIMPLEMENTED_LOG_ONCE();
34     return false;
35   }
Cancel()36   void Cancel() override { set_cancelled(); }
37 };
38 
39 }  // namespace
40 
FilePathWatcher()41 FilePathWatcher::FilePathWatcher()
42     : FilePathWatcher(std::make_unique<FilePathWatcherImpl>()) {}
43 
44 }  // namespace base
45