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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« 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