xref: /aosp_15_r20/external/cronet/base/files/file_path_watcher_stub.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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/check.h"
14 #include "base/notimplemented.h"
15 #include "base/task/sequenced_task_runner.h"
16 
17 namespace base {
18 
19 namespace {
20 
21 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
22  public:
23   FilePathWatcherImpl() = default;
24   FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
25   FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
26   ~FilePathWatcherImpl() override = default;
27 
28   // FilePathWatcher::PlatformDelegate:
Watch(const FilePath & path,Type type,const FilePathWatcher::Callback & callback)29   bool Watch(const FilePath& path,
30              Type type,
31              const FilePathWatcher::Callback& callback) override {
32     DCHECK(!callback.is_null());
33 
34     NOTIMPLEMENTED_LOG_ONCE();
35     return false;
36   }
Cancel()37   void Cancel() override { set_cancelled(); }
38 };
39 
40 }  // namespace
41 
FilePathWatcher()42 FilePathWatcher::FilePathWatcher()
43     : FilePathWatcher(std::make_unique<FilePathWatcherImpl>()) {}
44 
45 }  // namespace base
46