OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ | 5 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ |
6 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ | 6 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // descriptor |dest_fd|, without taking ownership of |dest_fd|. The paths listed | 34 // descriptor |dest_fd|, without taking ownership of |dest_fd|. The paths listed |
35 // in |src_relative_paths| are relative to the |src_dir| and will be used as the | 35 // in |src_relative_paths| are relative to the |src_dir| and will be used as the |
36 // file names in the created zip file. All source paths must be under |src_dir| | 36 // file names in the created zip file. All source paths must be under |src_dir| |
37 // in the file system hierarchy. | 37 // in the file system hierarchy. |
38 bool ZipFiles(const base::FilePath& src_dir, | 38 bool ZipFiles(const base::FilePath& src_dir, |
39 const std::vector<base::FilePath>& src_relative_paths, | 39 const std::vector<base::FilePath>& src_relative_paths, |
40 int dest_fd); | 40 int dest_fd); |
41 #endif // defined(OS_POSIX) | 41 #endif // defined(OS_POSIX) |
42 | 42 |
43 // Unzip the contents of zip_file into dest_dir. | 43 // Unzip the contents of zip_file into dest_dir. |
| 44 // For each file in zip_file, include it only if the callback |filter_cb| |
| 45 // returns true. Otherwise omit it. |
| 46 typedef base::Callback<bool(const base::FilePath&)> FilterCallback; |
| 47 bool UnzipWithFilterCallback(const base::FilePath& zip_file, |
| 48 const base::FilePath& dest_dir, |
| 49 const FilterCallback& filter_cb); |
| 50 |
| 51 // Unzip the contents of zip_file into dest_dir. |
44 bool Unzip(const base::FilePath& zip_file, const base::FilePath& dest_dir); | 52 bool Unzip(const base::FilePath& zip_file, const base::FilePath& dest_dir); |
45 | 53 |
46 } // namespace zip | 54 } // namespace zip |
47 | 55 |
48 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ | 56 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ |
OLD | NEW |