Chromium Code Reviews| Index: components/offline_pages/archive_manager.h |
| diff --git a/components/offline_pages/archive_manager.h b/components/offline_pages/archive_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f60370ce0d3debced98052817df3e80adbc9d160 |
| --- /dev/null |
| +++ b/components/offline_pages/archive_manager.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |
| +#define COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/ref_counted.h" |
| + |
| +namespace base { |
| +class SequencedTaskRunner; |
| +} // namespace base |
| + |
| +namespace offline_pages { |
| + |
| +// Class that manages all archive files for offline pages. They are all stored |
| +// in a specific archive directory. |
| +// All tasks are performed using |task_runner_|. |
| +class ArchiveManager { |
| + public: |
| + ArchiveManager(const base::FilePath& archives_dir, |
| + const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| + virtual ~ArchiveManager(); |
| + |
| + // 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.
|
| + virtual void EnsureArchivesDirCreated(const base::Closure& callback); |
| + |
| + // Checks whether an archive with specified |archive_path| exists. |
| + // 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.
|
| + // exist. |
| + virtual void ExistsArchive(const base::FilePath& archive_path, |
| + const base::Callback<void(bool)>& callback); |
| + |
| + // Deletes an archive with specified |archive_path|. |
| + // It is considered successful to attempt to delete a file that does not |
| + // exist. |
| + virtual void DeleteArchive(const base::FilePath& archive_path, |
| + const base::Callback<void(bool)>& callback); |
| + |
| + // Deletes multiple archives that are specified in |archive_paths|. |
| + 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.
|
| + const base::Callback<void(bool)>& callback); |
| + |
| + private: |
| + // Path under which all of the managed archives should be stored. |
| + base::FilePath archives_dir_; |
| + // Task runner for running file operations. |
| + scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_ |