OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_FILE_MANAGER_SNAPSHOT_MANAGER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_SNAPSHOT_MANAGER_H_ | |
7 | |
8 #include "base/callback_forward.h" | |
9 #include "base/files/file_path.h" | |
10 #include "base/memory/ref_counted.h" | |
11 | |
12 class Profile; | |
13 | |
14 namespace base { | |
15 class SequencedTaskRunner; | |
16 } // namespace base | |
17 | |
18 namespace file_manager { | |
19 | |
20 // Utility class for creating a snapshot file copy of a file system file. | |
21 // Contrary to the underlying implementation of fileapi's CreateSnapshotFile, | |
22 // the taken snapshot file will not be removed immediately. The life time is | |
23 // managed by this manager class. | |
hashimoto
2014/06/19 02:26:01
Why should we create a copy of the snapshot instea
kinaba
2014/06/19 04:41:56
That sounds far more better! Rewrote in the sugges
| |
24 class SnapshotManager { | |
25 public: | |
26 // The callback type for CreateManagedSnapshot. | |
27 typedef base::Callback<void(const base::FilePath&)> LocalPathCallback; | |
28 | |
29 explicit SnapshotManager(Profile* profile); | |
30 ~SnapshotManager(); | |
31 | |
32 // Creates a snapshot file copy of a file system file |absolute_file_path| and | |
33 // returns back to |callback|. Returns empty path for failure. | |
34 void CreateManagedSnapshot(const base::FilePath& absolute_file_path, | |
35 const LocalPathCallback& callback); | |
36 | |
37 private: | |
38 Profile* profile_; | |
39 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
40 base::FilePath base_path_; | |
41 DISALLOW_COPY_AND_ASSIGN(SnapshotManager); | |
42 }; | |
43 | |
44 } // namespace file_manager | |
45 | |
46 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_SNAPSHOT_MANAGER_H_ | |
OLD | NEW |