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

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: Fixing components_tests.gyp file. 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 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_
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