Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: components/offline_pages/archive_manager.h

Issue 1977853004: [Offline pages] Adding ArchiveManager to abstract offline archives management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a missing destructor for OfflinePageStorageManager::Client Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/archive_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..221d08636e72c7c900cb2fa816c3822e41e64ebb
--- /dev/null
+++ b/components/offline_pages/archive_manager.h
@@ -0,0 +1,58 @@
+// 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 if one does not exist yet;
+ virtual void EnsureArchivesDirCreated(const base::Closure& callback);
+
+ // Checks whether an archive with specified |archive_path| exists.
+ 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|.
+ // It is considered successful to attempt to delete a file that does not
+ // exist.
+ virtual void DeleteMultipleArchives(
+ const std::vector<base::FilePath>& archive_paths,
+ 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_
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/archive_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698