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

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: 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
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 {
jianli 2016/05/13 23:50:48 nit: add empty line
fgorski 2016/05/16 17:46:51 Done.
19 // Class that helps managing archive files. It will fail any operations on
jianli 2016/05/13 23:50:48 The comment "It will fail any operations on ..." i
fgorski 2016/05/16 17:46:52 Done.
20 // archives that are not in |archive_dir|.
21 class ArchiveManager {
22 public:
23 ArchiveManager(const base::FilePath& archives_dir,
24 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
25 virtual ~ArchiveManager();
26
27 // Creates archives directory of one does not exist yet;
jianli 2016/05/13 23:50:48 Please also comment above this line that all opera
fgorski 2016/05/16 17:46:51 Done.
28 virtual void EnsureArchivesDirCreated(const base::Closure& callback);
29
30 // Verifies whether an archive with specified |archive_path| exists.
jianli 2016/05/13 23:50:48 Verifies => Checks
fgorski 2016/05/16 17:46:51 Done.
31 virtual void ArchiveExists(const base::FilePath& archive_path,
jianli 2016/05/13 23:50:48 ExistsArchive
fgorski 2016/05/16 17:46:51 Done.
32 const base::Callback<void(bool)>& callback);
33
34 // Deletes an archive with specified |archive_path|.
35 virtual void DeleteArchive(const base::FilePath& archive_path,
36 const base::Callback<void(bool)>& callback);
37
38 // Deletes all archives in |archive_paths|.
jianli 2016/05/13 23:50:48 The comment "all archives" is very confusing. How
fgorski 2016/05/16 17:46:51 Done.
39 virtual void DeleteArchives(const std::vector<base::FilePath>& archive_paths,
40 const base::Callback<void(bool)>& callback);
41
42 private:
43 // Path under which all of the managed archives should be stored.
44 base::FilePath archives_dir_;
45 // Task runner for running file operations.
46 scoped_refptr<base::SequencedTaskRunner> task_runner_;
47 };
jianli 2016/05/13 23:50:48 nit: add empty line
fgorski 2016/05/16 17:46:52 Done.
48 } // namespace offline_pages
49
50 #endif // COMPONENTS_OFFLINE_PAGES_ARCHIVE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698