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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "build/build_config.h" |
12 | 13 |
13 namespace zip { | 14 namespace zip { |
14 | 15 |
15 // Zip the contents of src_dir into dest_file. src_path must be a directory. | 16 // Zip the contents of src_dir into dest_file. src_path must be a directory. |
16 // An entry will *not* be created in the zip for the root folder -- children | 17 // An entry will *not* be created in the zip for the root folder -- children |
17 // of src_dir will be at the root level of the created zip. For each file in | 18 // of src_dir will be at the root level of the created zip. For each file in |
18 // src_dir, include it only if the callback |filter_cb| returns true. Otherwise | 19 // src_dir, include it only if the callback |filter_cb| returns true. Otherwise |
19 // omit it. | 20 // omit it. |
20 typedef base::Callback<bool(const base::FilePath&)> FilterCallback; | 21 typedef base::Callback<bool(const base::FilePath&)> FilterCallback; |
21 bool ZipWithFilterCallback(const base::FilePath& src_dir, | 22 bool ZipWithFilterCallback(const base::FilePath& src_dir, |
(...skipping 16 matching lines...) Expand all Loading... |
38 const std::vector<base::FilePath>& src_relative_paths, | 39 const std::vector<base::FilePath>& src_relative_paths, |
39 int dest_fd); | 40 int dest_fd); |
40 #endif // defined(OS_POSIX) | 41 #endif // defined(OS_POSIX) |
41 | 42 |
42 // Unzip the contents of zip_file into dest_dir. | 43 // Unzip the contents of zip_file into dest_dir. |
43 bool Unzip(const base::FilePath& zip_file, const base::FilePath& dest_dir); | 44 bool Unzip(const base::FilePath& zip_file, const base::FilePath& dest_dir); |
44 | 45 |
45 } // namespace zip | 46 } // namespace zip |
46 | 47 |
47 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ | 48 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_H_ |
OLD | NEW |