1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_REMOVE_WATCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_REMOVE_WATCHER_H_ 7 8 #include <memory> 9 10 #include "base/files/file.h" 11 #include "base/macros.h" 12 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h" 13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" 15 #include "chrome/browser/chromeos/file_system_provider/request_value.h" 16 #include "storage/browser/file_system/async_file_util.h" 17 18 namespace base { 19 class FilePath; 20 } // namespace base 21 22 namespace extensions { 23 class EventRouter; 24 } // namespace extensions 25 26 namespace chromeos { 27 namespace file_system_provider { 28 namespace operations { 29 30 // Removes a watcher at |entry_path| with the |recursive| mode. 31 class RemoveWatcher : public Operation { 32 public: 33 RemoveWatcher(extensions::EventRouter* event_router, 34 const ProvidedFileSystemInfo& file_system_info, 35 const base::FilePath& entry_path, 36 bool recursive, 37 storage::AsyncFileUtil::StatusCallback callback); 38 ~RemoveWatcher() override; 39 40 // Operation overrides. 41 bool Execute(int request_id) override; 42 void OnSuccess(int request_id, 43 std::unique_ptr<RequestValue> result, 44 bool has_more) override; 45 void OnError(int request_id, 46 std::unique_ptr<RequestValue> result, 47 base::File::Error error) override; 48 49 private: 50 const base::FilePath entry_path_; 51 bool recursive_; 52 storage::AsyncFileUtil::StatusCallback callback_; 53 54 DISALLOW_COPY_AND_ASSIGN(RemoveWatcher); 55 }; 56 57 } // namespace operations 58 } // namespace file_system_provider 59 } // namespace chromeos 60 61 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_REMOVE_WATCHER_H_ 62