Chromium Code Reviews| 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 of one does not exist yet; | |
|
Dmitry Titov
2016/05/16 21:04:56
of->if
fgorski
2016/05/16 21:23:01
Done.
| |
| 30 virtual void EnsureArchivesDirCreated(const base::Closure& callback); | |
| 31 | |
| 32 // Checks whether an archive with specified |archive_path| exists. | |
| 33 // It is considered successful to attempt to delete a file that does not | |
|
Dmitry Titov
2016/05/16 21:04:56
copy/pasted comment?
fgorski
2016/05/16 21:23:01
Done.
| |
| 34 // exist. | |
| 35 virtual void ExistsArchive(const base::FilePath& archive_path, | |
| 36 const base::Callback<void(bool)>& callback); | |
| 37 | |
| 38 // Deletes an archive with specified |archive_path|. | |
| 39 // It is considered successful to attempt to delete a file that does not | |
| 40 // exist. | |
| 41 virtual void DeleteArchive(const base::FilePath& archive_path, | |
| 42 const base::Callback<void(bool)>& callback); | |
| 43 | |
| 44 // Deletes multiple archives that are specified in |archive_paths|. | |
| 45 virtual void DeleteArchives(const std::vector<base::FilePath>& archive_paths, | |
|
Dmitry Titov
2016/05/16 21:04:56
I'd suggest DeleteMultipleArchives to make these n
fgorski
2016/05/16 21:23:01
Done.
| |
| 46 const base::Callback<void(bool)>& callback); | |
| 47 | |
| 48 private: | |
| 49 // Path under which all of the managed archives should be stored. | |
| 50 base::FilePath archives_dir_; | |
| 51 // Task runner for running file operations. | |
| 52 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
| 53 }; | |
| 54 | |
| 55 } // namespace offline_pages | |
| 56 | |
| 57 #endif // COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ | |
| OLD | NEW |