| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 |
| 14 namespace base { |
| 15 class SequencedTaskRunner; |
| 16 } // namespace base |
| 17 |
| 18 namespace offline_pages { |
| 19 |
| 20 // Class that manages all archive files for offline pages. They are all stored |
| 21 // in a specific archive directory. |
| 22 // All tasks are performed using |task_runner_|. |
| 23 class ArchiveManager { |
| 24 public: |
| 25 ArchiveManager(const base::FilePath& archives_dir, |
| 26 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| 27 virtual ~ArchiveManager(); |
| 28 |
| 29 // Creates archives directory if one does not exist yet; |
| 30 virtual void EnsureArchivesDirCreated(const base::Closure& callback); |
| 31 |
| 32 // Checks whether an archive with specified |archive_path| exists. |
| 33 virtual void ExistsArchive(const base::FilePath& archive_path, |
| 34 const base::Callback<void(bool)>& callback); |
| 35 |
| 36 // Deletes an archive with specified |archive_path|. |
| 37 // It is considered successful to attempt to delete a file that does not |
| 38 // exist. |
| 39 virtual void DeleteArchive(const base::FilePath& archive_path, |
| 40 const base::Callback<void(bool)>& callback); |
| 41 |
| 42 // Deletes multiple archives that are specified in |archive_paths|. |
| 43 // It is considered successful to attempt to delete a file that does not |
| 44 // exist. |
| 45 virtual void DeleteMultipleArchives( |
| 46 const std::vector<base::FilePath>& archive_paths, |
| 47 const base::Callback<void(bool)>& callback); |
| 48 |
| 49 private: |
| 50 // Path under which all of the managed archives should be stored. |
| 51 base::FilePath archives_dir_; |
| 52 // Task runner for running file operations. |
| 53 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 54 }; |
| 55 |
| 56 } // namespace offline_pages |
| 57 |
| 58 #endif // COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |
| OLD | NEW |